Supermind Search Consulting Blog 
Solr - Elasticsearch - Big Data

Posts about Ubuntu

[SOLVED] Frequent disconnects on Ubuntu 12.04 iwlwifi Centrino 2200

Posted by Kelvin on 20 Nov 2015 | Tagged as: Ubuntu

On certain wireless routers, I was getting the dreaded "wlan0: deauthenticating from … by local choice", resulting in constant disconnects (every 30 seconds or less). I tried a whole bunch of options (disabling 11n, disabling hw scanning etc) and the only thing that eventually worked was disabling ipv6.

sudo gedit /etc/sysctl.conf
 
#Add these lines at the end:
 
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
 
#Save the file.
sudo sysctl -p

Worked rightaway without reboot.

Mapping alt-pgup and alt-pgdown to home and end in ubuntu

Posted by Kelvin on 12 Nov 2013 | Tagged as: Ubuntu

On my Lenovo T530 laptop, the PgUp and PgDown keys are right next to the arrow keys, which makes for very smooth code navigation. Unfortunately, the Home and End keys are far away, above the Backspace key to be precise.

Here's how to map Alt + PgUp -> Home and Alt + PgDown -> End in Ubuntu using xbindkeys.

sudo apt-get install xbindkeys xbindkeys-config xvkbd
xbindkeys --defaults > ~/.xbindkeysrc

Now paste the following into ~/.xbindkeysrc.

"xvkbd -xsendevent -text '\[Home]'"
  Alt+Mod2 + Prior | m:0x18 + c:112
 
"xvkbd -xsendevent -text '\[End]'"
  Alt+Mod2 + Next | m:0x18 + c:117

Then start xbindkeys. You may need to add xbindkeys to the list of startup applications.

[SOLVED] gedit Invalid byte sequence in conversion input

Posted by Kelvin on 07 Nov 2013 | Tagged as: Ubuntu

I've been tearing my hair out lately trying to open UTF-8 encoded text files in gedit (Ubuntu 12.04). For some reason, the auto charset detection mechanism is broken. Opening the same files using gvim or leafpad just works. Googling for a solution didn't help either.

Well, I found the fix. What you need to do is to declare the encodings using gsettings, and the order you'd like. Here's mine:

gsettings set org.gnome.gedit.preferences.encodings auto-detected "['UTF-8', 'CURRENT', 'ISO-8859-15', 'UTF-16']"

Getting around protected read-only MS Word/LibreOffice odt documents

Posted by Kelvin on 13 Jun 2012 | Tagged as: Ubuntu

I recently received an agreement in MS Word format which I wanted to fill out, but couldn't because it was protected/read-only. Opening the document in LibreOffice writer didn't significantly improve the situation.. whole sections of the document was still marked read-only.

Here's what I did to get around it:

1. Open .doc in LibreOffice Writer, save as .odt
2. Open .odt in AbiWord, make changes, save back to .odt
3. (optional) Open .odt in LibreOffice Writer and do whatever else you need to do

At this point, you're probably wondering: why not open the .doc in AbiWord in the first place? Well, AbiWord didn't import the .doc very well, with lots of formatting issues, missing characters etc. Using LibreOffice Writer to convert the .doc to .odt bypasses this.

Split wav/flac/ape files with cue

Posted by Kelvin on 07 May 2012 | Tagged as: Ubuntu

This entry is part 19 of 19 in the Bash-whacking series

If you ever need to split a disc image which has been burned as a single wav/flac/ape file with a corresponding cue file, this will help you out.

Split2flac does all the tedium of splitting, renaming (according to a renaming pattern of your choosing), converting to FLAC/M4A/MP3/OGG_VORBIS/WAV, as well as adding ID3 tags.

cd /usr/local/bin
sudo wget https://raw.github.com/ftrvxmtrx/split2flac/fe1f5a2c62dad5c514b118fbb90f7974ae28f712/split2flac
sudo chmod +x split2flac

Now type "split2flac -h" for usage instructions.

Batch convert svg to png in Ubuntu

Posted by Kelvin on 19 Oct 2011 | Tagged as: Ubuntu

This entry is part 18 of 19 in the Bash-whacking series
sudo apt-get install librsvg2-bin
for i in *; do rsvg-convert -a $i -o `echo $i | sed -e 's/svg$/png/'`; done

to rasterize the svg at 300dpi, shrinking dimensions by 50%:

for i in *; do rsvg-convert -z 0.5 -d 300 -p 300 -a $i -o `echo $i | sed -e 's/svg$/png/'`; done

Mount a .dmg file in Ubuntu

Posted by Kelvin on 11 Oct 2011 | Tagged as: Ubuntu

This entry is part 17 of 19 in the Bash-whacking series
sudo apt-get install dmg2img
dmg2img /path/to/image.dmg
sudo modprobe hfsplus
sudo mount -t hfsplus -o loop image.img /mnt

The .dmg archive is now mounted at /mnt. You can browse it either via command-line or via Nautilus.

Courtesy of http://iremedy.net/blog/2010/11/how-to-mount-a-dmg-file-in-ubuntu-linux/

Delete directories older than x days

Posted by Kelvin on 04 Aug 2011 | Tagged as: Ubuntu

This entry is part 16 of 19 in the Bash-whacking series

Great for cleaning up log directories.

find . -maxdepth 1 -mtime +14 -type d -exec rm -fr {} \;

Change 14 to the required age in days.

Determine if a server supports Gzip compression

Posted by Kelvin on 06 Jun 2011 | Tagged as: Ubuntu

This entry is part 15 of 19 in the Bash-whacking series
echo "Size WITHOUT accepting gzip"
curl http://www.supermind.org --silent --write-out "size_download=%{size_download}\n" --output /dev/null
echo "Size WITH accepting gzip"
curl http://www.supermind.org --silent -H "Accept-Encoding: gzip,deflate"  --write-out "size_download=%{size_download}\n" --output /dev/null

You can of course substitute the URL with a different one.

On my site, this is what I get:

$curl http://www.supermind.org --silent --write-out "size_download=%{size_download}\n" --output /dev/null
$size_download=10560
$curl http://www.supermind.org --silent -H "Accept-Encoding: gzip,deflate"  --write-out "size_download=%{size_download}\n" --output /dev/null
$size_download=4345

HOWTO: Add gzip support to Squid 3.1 in Ubuntu

Posted by Kelvin on 06 Jun 2011 | Tagged as: Ubuntu

The squid3 deb that's available in the apt repos don't come configured with ecap support, which is required to support serving of gzip-compressed pages to clients.

In a network environment where the majority of traffic is wireless (like where I live), reducing the payload of internal network requests will have a positive impact on performance.

Follow instructions precisely at http://code.google.com/p/squid-ecap-gzip/wiki/Installation.

You should use Squid 3.1.11 and ecap 0.03 even though more recent versions are available. I tried compiling with 3.1.12.2 and ran into a bunch of make errors, where 3.1.11 compiled just fine.

The one step where I deviated from the instructions, was when configuring Squid. I used, instead, configure options which were closer to the original Ubuntu release. Here it is:

./configure '--build=i686-linux-gnu' '--prefix=/usr' '--includedir=${prefix}/include' '--mandir=${prefix}/share/man' '--infodir=${prefix}/share/info' '--sysconfdir=/etc' '--localstatedir=/var' '--libexecdir=${prefix}/lib/squid3' '--disable-maintainer-mode' '--disable-dependency-tracking' '--disable-silent-rules' '--srcdir=.' '--datadir=/usr/share/squid3' '--sysconfdir=/etc/squid3' '--mandir=/usr/share/man'  '--enable-inline' '--enable-async-io=8' '--enable-storeio=ufs,aufs,diskd' '--enable-removal-policies=lru,heap' '--enable-delay-pools' '--enable-cache-digests' '--enable-underscores' '--enable-icap-client' '--enable-follow-x-forwarded-for'  '--enable-arp-acl' '--enable-esi' '--disable-translation' '--with-logdir=/var/log/squid3' '--with-pidfile=/var/run/squid3.pid' '--with-filedescriptors=65536' '--with-large-files' '--with-default-user=proxy' '--enable-linux-netfilter' --enable-ecap

The last switch adds support for ecap.

Next Page »