Skip to content

Instantly share code, notes, and snippets.

View manuelmorales's full-sized avatar

Manuel Morales manuelmorales

View GitHub Profile
@manuelmorales
manuelmorales / tmux_basics.sh
Created January 29, 2012 15:11
From GNU screen to tmux
# ~/.tmux.conf
# Will make Ctrl-a as the prefix
unbind C-b
set -g prefix C-a
# Force 256 colors
tmux -2
# Basic moves
c # create new window
@manuelmorales
manuelmorales / memcached.sh
Created January 31, 2012 09:58
How to start memcached
sudo /usr/bin/memcached -vv -p 11211 -m 64 -c 1024 -u memcached -P /var/run/memcached/memcached-11211.pid
@manuelmorales
manuelmorales / git_forget.sh
Created February 5, 2012 18:29
Remove commits from Git history
export BRANCH=edge
export FIRST="hash_of_the_commit_from_which_to_start_forgetting"
export SECOND="hash_of_the_commit_from_which_to_keep_commits"
git checkout $BRANCH
git checkout $SECOND
git reset --soft $FIRST
git commit -C $SECOND
git rebase --onto HEAD $SECOND $BRANCH
@manuelmorales
manuelmorales / test_solr_with_curl.sh
Last active September 30, 2015 12:28
Solr Sunspot cheat sheet (with curl)
curl http://localhost:8983/solr?q=ppt
http://0.0.0.0:8983/solr/admin/ping
Sunspot.remove(User){ with :account_id, 6465 }
@manuelmorales
manuelmorales / clickpad_setup_ubuntu.sh
Created February 19, 2012 00:26
HP dv3 ClickPad setup for Ubuntu 11.10 Oneiric Ocelot
# Install the patch
sudo add-apt-repository ppa:sergio91pt/synaptics+clickpads
sudo apt-get update
sudo apt-get install synaptics-touchpad
# Tweak the default settings
sudo vi /usr/share/X11/xorg.conf.d/51-synaptics-quirks.conf
# Add to the end
Section "InputClass"
@manuelmorales
manuelmorales / curl_cookies.sh
Last active October 1, 2015 12:48
Make a post with curl using cookies
export SERVER=dev.workshare.com
export [email protected]
read PASS
# Logging in
curl -X POST https://$SERVER/api/v1.2/user_sessions.json -F "user_session[email]=$USER" -F "user_session[password]=$PASS" -b tmp/dev.jar -c tmp/dev.jar
# Validating user with ID 99999
curl -X PUT https://$SERVER/users/99999.json -b tmp/dev.jar -c tmp/dev.jar -F 'record[is_unknown_user]=false'
@manuelmorales
manuelmorales / convert_and_rotate.sh
Created March 10, 2012 15:58
Rotate video and convert to MPG
ffmpeg -vf "transpose=1" -sameq -target ntsc-vcd -i input.m4v out.mpg
@manuelmorales
manuelmorales / ghostxps.sh
Created April 17, 2012 11:01
Installing GhostPDL (with GhostXPS) on Ubuntu Oneiric
sudo apt-get install libxext-dev libxt-dev
wget http://downloads.ghostscript.com/public/ghostpdl-9.05.tar.bz2
tar xjf ./ghostpdl-9.05.tar.gz
cd ghostpdl-9.05/
./configure
echo '#define HAVE_SYS_TIME_H' >> xps/obj/gconfig_.h
make xps
./xps/obj/gxps -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -r150 -o /tmp/a.pdf ~/POWERPOINT.xps
@manuelmorales
manuelmorales / rotate_pdf.sh
Created April 20, 2012 17:31
How to rotate each page of a PDF 90 degrees
pdf90 --angle 180 --suffix 'turned' --batch my_file.pdf
@manuelmorales
manuelmorales / audio_to_mp3.rb
Created April 27, 2012 21:57
Reencode audio of an AVI to MP3
#!/usr/bin/ruby
ARGV.each do |input_f|
everything_ok = true
# Escapes single quotes
input_f = input_f.split("'").join("\'\\'\'")
# Extracts the file name without extension
file_name = input_f.split(".")[0..-2].join(".")