Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
#put name of device here
MYMOUNTDIR=/mnt/location/here
PASSFILE=/home/yourname/passfile.kdb
DEVICEDIR=/dev/sdc1
if [ -b /dev/sdc ]; then
echo Mounting /dev/sdc
exo-mount -d $DEVICEDIR || exit 1
@lionelyoung
lionelyoung / gist:409744
Created May 22, 2010 03:52
toggles between Dvorak input and us
#!/bin/bash
#setxkbmap -option grp:switch,grp:alts_toggle us,dvorak
setxkbmap -option grp:switch,grp:alt_shift_toggle us,dvorak
#* alt_shift_toggle
#* ctrl_shift_toggle
#* ctrls_toggle
@lionelyoung
lionelyoung / img2pdf.sh
Created May 22, 2010 03:58
Converts an image to PDF. Useful for making PDF images for use in Latex.
#!/bin/bash
if [ ! -f "$1" ] ; then
echo "Input file $1 doesn't exist"
exit 1
fi
TITLE=${1%%.*}
#echo $TITLE
mogrify -format eps $1 && epstopdf $TITLE.eps
@lionelyoung
lionelyoung / pdftoeps.sh
Created May 22, 2010 04:00
Convert a PDF file to an EPS, for use with Latex embedding
#!/bin/bash
while test $# -gt 0 ;
do
case $1 in
*.pdf)
/usr/bin/gs -dNOPAUSE -dNOCACHE -dBATCH -sDEVICE=epswrite -sOutputFile=${1%.pdf}.eps $1
;;
*)
#!/bin/bash
#
# Download the solutions to ME422, which are posted every week
#
# Created Wed Oct 3 10:33:57 PDT 2007
# Explanation of wget switches
# nH No host
# nc no clobber, don't replace existing files
#!/bin/bash
# Print out the html locations of all the files in public_html
# Quick and dirty script just to get some HTML links to the mp3s in the public_html folder
MYDIR=/home/lionel/public_html
DYNDNS=mydyndnsusername
cd $MYDIR || exit 1
ls -t *.mp3 | sed -r 's|(.*)|<a href="\1">\1<\/a><br>|g' > music.html
echo "http://$DYNDNS.ath.cx/~lionel/music.html"
#!/usr/bin/bash
echo "Untracked Projects:"
echo "-------------------"
for i in *
do
if [ -d $i ]; then
if ! [ -d $i/.git ]; then
echo $i
fi
@lionelyoung
lionelyoung / gist:755145
Created December 26, 2010 01:48
Connecting to PDANet WiFi HotSpot with Linux
ifconfig wlan0 down
iwconfig wlan0 mode ad-hoc
iwconfig wlan0 essid <ESSID>
iwconfig wlan0 key <TENDIGITPASSWORD>
ifconfig wlan0 up
dhclient wlan0
@lionelyoung
lionelyoung / gist:3735310
Created September 17, 2012 02:53
Go XMLRPC Method
func xmlrpc(url string, methodName string, args ...string) string {
// Marshal XML
type Param struct {
Entry string `xml:"value>string"`
}
type methodCall struct {
XMLName xml.Name `xml:"methodCall"`
MethodName string `xml:"methodName"`
Params []Param `xml:"params>param"`
@lionelyoung
lionelyoung / adwords_kw.r
Last active December 14, 2015 19:59
Adwords Chi-Squared in R
kw = read.csv("~/Downloads/keywords.csv", skip=1)
kw.conv <- subset(kw, Keyword.state == "enabled" & Conv...1.per.click. > 0)
View(kw.conv)
convs <- unlist(c(kw.conv["Conv...1.per.click."]))
clicks <- unlist(c(kw.conv["Clicks"]))
prop.test(convs,clicks,alternative=c("greater"))