Skip to content

Instantly share code, notes, and snippets.

View wbond's full-sized avatar

Will Bond wbond

View GitHub Profile
@wbond
wbond / gist:4771091
Created February 12, 2013 16:26
Configure USB Audio to Default in Linux

~/.asoundrc

pcm.!default {
    type hw
    card CODEC
}
ctl.!default {
    type hw
    card CODEC
}
@wbond
wbond / gist:4277372
Created December 13, 2012 15:55
Lenovo W520 Headphones Speaker Mute - this is necessary to get the speakers to mute when headphones are plugged in
# sudo nano /etc/modprobe.d/sound.conf
options snd-hda-intel model=thinkpad
@wbond
wbond / gist:3800562
Created September 28, 2012 15:34
Lenovo W520/T520/T530 Boot Instructions for Fedora 17
In order to get external displays working on Fedora 17+ with recent Lenovo laptops containing Optimus graphics you need to perform a few steps.
1. Enter bios, go to Config > Display
2. Change display to Discrete graphics (disable Optimus since Linux doesn't support it yet)
3. Set the default boot screen to Digital on Dock (if you have one)
4. Reboot
5. At grub2 loading screen, hit e to edit the boot params
6. Find the line that starts with `linux` and add ` nox2apic` to the end of it
7. Boot linux (ctrl-x maybe?)
8. Once booted and logged in, run `sudo nano /etc/default/grub` from the terminal
@wbond
wbond / postgresql_upgrade.sh
Created September 21, 2012 06:18
Upgrade from PostgreSQL 9.1 to 9.2
apachectl stop
/root/src/postgresql-9.2.0/src/bin/pg_dump/pg_dumpall > /root/pgsql.backup
/etc/init.d/postgresql stop
mv /usr/local/pgsql /usr/local/pgsql.bak
cd /root/src/postgresql-9.2.0
make install
su postgres
/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
exit
@wbond
wbond / rsv
Created September 10, 2012 15:14
Script to start rails server on open port and open in Chrome
#!/bin/bash
PORT=3000
while [[ $(netstat -lnt | grep ":$PORT ") != "" ]]; do
PORT=$(($PORT + 1))
done
rails server -p $PORT &
SERVEPID=$!
Packages/User/Preferences.sublime-settings
{
"color_scheme": "Packages/Color Scheme - Default/Sunburst.tmTheme",
"font_size": 14.0
}
Packages/User/Default.sublime-commands
[
{
"caption": "CSS rules compact",
@wbond
wbond / gist:1645353
Created January 20, 2012 04:59
Compile _ssl.so
# Fedora
yum install make automake gcc gcc-c++ openssl-devel
# Ubuntu
apt-get install build-essential libssl-dev
# Both
curl -sS http://www.python.org/ftp/python/2.6.6/Python-2.6.6.tar.bz2 > Python-2.6.6.tar.bz2
tar xvfj Python-2.6.6.tar.bz2
cd Python-2.6.6
@wbond
wbond / gist:1387749
Created November 23, 2011 02:32
Got sick of the terrible handling of application shortcuts by window managers, so here are some rough steps to build a custom version of Chromium that works with Gnome Shell on Gnome 3 for Fedora Core 16
# Based on:
# http://hacktux.com/fedora/source/rpm
# http://fedoraproject.org/wiki/Chromium
# http://codereview.chromium.org/7562022/patch/1/2
# as root
cd /etc/yum.repos.d/
wget http://repos.fedorapeople.org/repos/spot/chromium-stable/fedora-chromium-stable.repo
yum -y install yum-utils rpmdevtools elfutils-libeld-devel libXt-devel
exit
@wbond
wbond / gist:1358295
Created November 11, 2011 15:38
FC16 Notes
sudo -s
yum install nano
nano /etc/selinux/config # disable
reboot
# clean dock
sudo -s
yum update
@wbond
wbond / gist:1338771
Created November 4, 2011 06:14
Sublime SFTP Upload via Python
import sublime
sublime.active_window().run_command('sftp_upload_file', {'paths': ['/path/to/file']})