Skip to content

Instantly share code, notes, and snippets.

View deckerego's full-sized avatar

John Ellis deckerego

View GitHub Profile
@deckerego
deckerego / mysql_csv_export.sh
Created December 6, 2013 16:56
To export a data set as a CSV file within the MySQL console
select * into outfile '/home/username/data/my_table.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' ESCAPED BY '\\' LINES TERMINATED BY '\n' from my_table;
@deckerego
deckerego / wake_up_wlan.sh
Created December 6, 2013 17:10
For some reason Cisco' WAPs using WPA2 have issues negotiating with some Linux wlan adapters; it seems the initial negotiation fails, and rather than re-try the adapter just quits and assumes you have bad settings. The Cisco WAP seems to (usually) reject the first connection attempt and then accept subsequent ones. The following seems to do an a…
iwconfig wlan0 mode managed
iwpriv wlan0 set AuthMode=WPA2PSK
iwpriv wlan0 set EncrypType=AES
iwconfig wlan0 essid "waps_ssid"
iwpriv wlan0 set WPAPSK="waps_wpa2_password"
iwconfig wlan0 essid "waps_ssid"
iwconfig wlan0 mode managed
@deckerego
deckerego / swap_file.sh
Last active October 13, 2016 18:34
Create swap file in Linux (as opposed to a swap partition)
dd if=/dev/zero of=/swapfile bs=1024 count=1048576
chmod 0600 /swapfile
mkswap /swapfile
swapon /swapfile
echo '/swapfile none swap sw 0 0' >> /etc/fstab
@deckerego
deckerego / update_svn.sh
Created December 6, 2013 17:11
Update all SVN projects in a workspace
find ~/NetBeansProjects ~/workspace -maxdepth 1 -mindepth 1 -type d ! -name ".*" -execdir svn update {} \;
@deckerego
deckerego / svn_ignore.sh
Created December 6, 2013 17:12
Have Subversion Ignore a Directory
svn propset svn:ignore ignore_path/ .
@deckerego
deckerego / find_nonsvn.sh
Created December 6, 2013 17:13
How to list all files in a directory, ignoring hidden Subversion metadata directories
find ./directory/ -not \( -name .svn -prune \) -type f -printf "%p\t"
@deckerego
deckerego / pg_hba.conf
Created December 6, 2013 17:13
PostgreSQL is set up for local authentication by default, so there has to be some minor tomfoolery to get it to accept JDBC connections that don't rely on host-based authentication. Modify /var/lib/pgsql/data/pg_hba.conf to look similar to the following.
# TYPE DATABASE USER CIDR-ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all ident sameuser
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
@deckerego
deckerego / decrypt_bz2.sh
Created December 6, 2013 17:14
Compress and encrypt a tarball in a single line
gpg -d archive.DATE.tar.bz2.gpg | tar xvj
@deckerego
deckerego / ssh_keygen.sh
Created December 6, 2013 17:21
Key-based authentication (SSH authentication that uses certificates instead of passwords) must first be enabled by the SSH server itself. Most distros seem to allow this by default. First create a id_rsa.pub / id_rsa key pair with the following command, then take the contents of id_rsa.pub (not the other one) and appended it to the end of ~/.ssh…
ssh-keygen -t rsa
@deckerego
deckerego / bell_off.sh
Created December 6, 2013 17:21
Turn off the system bell. I turn it off both in the terminal and in X, just because I can.
setterm -blength 0
[[ -n $DISPLAY ]] && xset -b