Categories
Windows

Google Chrome changed background colors

I updated Chrome to version 68.0.3440.75 (Official Build) (64-bit) just the other day and found that my browser windows had the background color change from white to a washed out looking pink. At first I thought it was a monitor issue, but other browsers and applications looked fine.

I tried a few things to fix it, including changed chrome settings by going to “chrome://flags/#windows10-custom-titlebar” and trying that setting with both disabled/enabled.

Turns out what fixed it was to disable hardware acceleration! Not sure why the new version of Chrome handles that differently, the setting was the same on the older version. But in any case, to turn it off, go to “settings”, scroll to the bottom and click “Advanced”, then towards the end under “System” you can turn off hardware acceleration.

Categories
Coding Websites

Applying callback to grecaptcha

We were having some troubles with some users rushing to click the submit button on a form immediately after clicking the good ‘ole “I’m not a robot” checkbox, instead of waiting nicely for the captcha to verify. By the way, that is TOTALLY what a robot would do, so it’s probably good that it fails the verification.

But to get the submit button to only enable after the checkbox turns green, you need to provide a “callback” routine for the grecaptcha. And, you can also provide a “expired-callback” routine for if the captcha box sits around too long after a check and then turns red. Note that you need to put the defined callbacks without quotes.

Also to add some complexity, we had two separate captchas in our page, so we had to define two of them. Some people have reported troubles doing so, but our final solution worked.

We had a problem where the callback routines were not being called, but everything else was working — it turns out we have the callback functions defined AFTER the render, and moving them before that section made everything work. So, the final layout:

<script src=”https://www.google.com/recaptcha/api.js?onload=myCaptInit&render=explicit” async defer></script>
<script>
var myCaptInit = function() {
var buton11 = function() {
$(“#mainsubmit”).removeAttr(“disabled”);
};
var butoff11 = function() {
$(“#mainsubmit”).attr(“disabled”, “disabled”);
};
grecaptcha.render(‘recaptcha11’, {
‘sitekey’: ‘xxxx’,
‘callback’: buton11,
‘expired-callback’: butoff11,
‘size’: ‘compact’
});
grecaptcha.render(‘recaptcha10’, {
‘sitekey’ : ‘xxxx’,
‘size’ : ‘compact’
});
};
</script>

Categories
Hardware Unix

Recovery LVM Data from RAID

We had a client that had an OLD fileserver box, a Thecus N4100PRO. It was completely dust-ridden and the power supply had burned out.

Since these drives were in a RAID configuration, you could not hook any one of them up to a windows box, or a linux box to see the data. You have to hook them all up to a box and reassemble the RAID.

We took out the drives (3 of them) and then used an external SATA to USB box to connect them to a Linux server running CentOS. You can use parted to see what drives are now being seen by your linux system:

parted -l | grep ‘raid\|sd’

Then using that output, we assembled the drives into a software array:

mdadm -A /dev/md0 /dev/sdb2 /dev/sdc2 /dev/sdd2

If we tried to only use two of those drives, it would give an error, since these were all in a linear RAID in the Thecus box.

If the last command went well, you can see the built array like so:

root% cat /proc/mdstat
Personalities : [linear]
md0 : active linear sdd2[0] sdb2[2] sdc2[1]
1459012480 blocks super 1.0 128k rounding

Note the personality shows the RAID type, in our case it was linear, which is probably the worst RAID since if any one drive fails, your data is lost. So good thing these drives outlasted the power supply! Now we find the physical volume:

pvdisplay /dev/md0

Gives us:

— Physical volume —
PV Name /dev/md0
VG Name vg0
PV Size 1.36 TB / not usable 704.00 KB
Allocatable yes
PE Size (KByte) 2048
Total PE 712408
Free PE 236760
Allocated PE 475648
PV UUID iqwRGX-zJ23-LX7q-hIZR-hO2y-oyZE-tD38A3

Then we find the logical volume:

lvdisplay /dev/vg0

Gives us:

— Logical volume —
LV Name /dev/vg0/syslv
VG Name vg0
LV UUID UtrwkM-z0lw-6fb3-TlW4-IpkT-YcdN-NY1orZ
LV Write Access read/write
LV Status NOT available
LV Size 1.00 GB
Current LE 512
Segments 1
Allocation inherit
Read ahead sectors 16384

— Logical volume —
LV Name /dev/vg0/lv0
VG Name vg0
LV UUID 0qsIdY-i2cA-SAHs-O1qt-FFSr-VuWO-xuh41q
LV Write Access read/write
LV Status NOT available
LV Size 928.00 GB
Current LE 475136
Segments 1
Allocation inherit
Read ahead sectors 16384

We want to focus on the lv0 volume. You cannot mount yet, until you are able to lvscan them.

lvscan

Show us things are inactive currently:

inactive ‘/dev/vg0/syslv’ [1.00 GB] inherit
inactive ‘/dev/vg0/lv0’ [928.00 GB] inherit

So we set them active with:

vgchange vg0 -a y

And doing lvscan again shows:

ACTIVE ‘/dev/vg0/syslv’ [1.00 GB] inherit
ACTIVE ‘/dev/vg0/lv0’ [928.00 GB] inherit

Now we can mount with:

mount /dev/vg0/lv0 /mnt

And viola! We have our data up and accessable in /mnt to recover! Of course your setup is most likely going to look different from what I have shown you above, but hopefully this gives some helpful information for you to recover your own data.

Categories
Coding Unix

SFTP in Perl Connecting to Legacy Server

We had a client that had a need to do automated SFTPs to various sites. It turns out that some of the sites had an older SSHD that would generate an error like “DH Group Exchange reply out of range”, and that required this parameter if you were using SFTP from the command line:

-oKexAlgorithms=diffie-hellman-group1-sha1

Now in Perl we were using Net::SFTP and it took some finagling (yes, that’s really a word) to figure out the proper settings, so here they were in case you were having trouble. And we had to add the warn flag otherwise we would get this warning:

Couldn’t fsetstat: Permission denied

Another oddity was that when we were putting files, the SFTP server allowed multiple files with the same name! Very odd, so we had to make sure to add a $sftp->do_remove command prior to the put command.

Here is what we used for the function call:

%sftp_args =
( “user” => “myuser”,
“password” => “mypass”,
“debug” => 0,
“warn” => 0,
“ssh_args” => [ options => [ “KexAlgorithms diffie-hellman-group1-sha1” ] ]
);

$sftp = Net::SFTP->new($sftp_host,%sftp_args);

Categories
Unix

Adding Skype to Pidgin

I’m running Fedora Linux using KDE and like using the IM client Pidgin to handle gmail/yahoo im services. But I just recently added Skype which is nice… I did get an error message from Pidgin at first, “Failed getting PIE value” which was due to the skype client plugin being too old in my yum installation. So, I installed by source as follows and everything worked great!

git clone git://github.com/EionRobb/skype4pidgin.git
cd skype4pidgin/skypeweb
make
sudo make install

 

Categories
Windows

Recover missing space on USB thumb drive

I have an 8GB thumb drive that I used to burn a boot image onto, and then when I was done with it the damn thing showed 49MB and re-formatting did not make it any bigger! So how to get back my original free space?

I figured I was going to have to plug it into my linux box and do some gpart or fdisk stuff, but turns out Windows has some handy tools. First to see what your thumb drive looks like, search for “disk management” or “create and format hard disk partitions” and you’ll find the tool to use.

Choose the thumb drive and you’ll see all your missing space in the “unallocated” box!

Now run the windows command “diskpart” from msdos prompt. Type “list disk” to see the drives. Based on the disk number in the parition tool you will type “select disk N” where N is the disk number from the parition tool list.

Then do the commands “clean”, and “create primary partition”

If you have your partition tool open you will see these commands take effect realtime so you know it is working, and that is it!

 

Categories
Unix

Postfix shows Connection Timed Out but direct telnet works

I ran into an interesting problem the other day when a client’s mail server was failing to send email. If you viewed the mail queue you would see a lot of “Connection timed out” errors.

Now one way to test this is to manually telnet to port 25 of the server you are emailing to, and walk through the handshaking manually. This in fact worked in this case! So why wouldn’t Postfix work?

The one thing that comes to mind is the ISP is not allowing port 25 outgoing, or in general it is a firewall issue. But as I said, I could use telnet just fine.

I found that the server had multiple IP addresses configured, and indeed it was a firewall issue, BUT only on some of the IPs! You can configure Postfix to use certain IPs outbound under certain scenarios, which was exactly the problem. After editing “/etc/postfix/master.cf” and reviewing the lines with “smtp_bind_address”, once I updated those address settings to be the main server IP that was allowed outbound, then everything worked.

Categories
Coding Unix

Installing Node.js4 in Centos7 with Yum

A quick summary that may help people who are installing AngularJS v2 and need to make sure they have the latest stuff.

First off, CentOS does not use a recent version of Node,js or NPM due to, well, lots of reasons! In fact the version the repo has for Nodejs is ZERO and it is already up to 4, 5 and 6. So that’s pretty damn old. When I’m in the software store and the guy asks “hey, do you want version 6 of that software?”, I rarely find myself saying, “Nah, please hit me with version zero.” What software store do I speak of? Well, this one of course!

All your software needs conveniently located at the shopping mall

Anyway, here is what you do to get the version 4 for nodejs etc:

curl –silent –location https://rpm.nodesource.com/setup_4.x | bash –

yum install -y nodejs

Categories
Unix Websites

Disable search in google chrome address bar

I dislike how Chrome has turned the address bar (also known as a “location bar” or “URL bar”) into an “Omnibox”. Since I run Chrome on my Linux box, and I have a bunch of test hosts defined in my /etc/hosts file, everytime I try to shortcut by just typing a dev hostname, Google pops up a damn search result!

There are some posted methods to avoid this. One was to check chrome://flags, which does have a bunch of nice settings, however my version of Chrome DID NOT have the one to do this!

Instead I found that creating my own search engine option was the solution. Go to chrome://settings/ and choose “Manage Search Engines”. In there, add a new one with “none”, “null” and “http://%s” as the options.

Boom! No more annoying forced search! Suck it, Omnibox!

OK, deep breath.

Categories
Websites

Amazon S3 forcing streaming or download

When you upload MP3 files into AWS S3, they will default to being a content-type that browsers will treat as a download (I believe “octet-stream”). If you want to change this so the delivery will be streaming, you need to change the content-type to “audio/mpeg” via the AWS console by editing “Properties” -> “Metadata”:

And if you want to revert back to forcing download, just remove the content-type metadata — note that there is no pulldown value for octet-stream!