Skip to content

Instantly share code, notes, and snippets.

View FernandoEscher's full-sized avatar
🏠
Working from home

Fernando Irias Escher FernandoEscher

🏠
Working from home
  • Tegucigalpa, Honduras
View GitHub Profile
require 'nokogiri'
require 'open-uri'
require 'terminal-notifier'
title = 'Bitcoin Gem'
activate = 'com.googlecode.iterm2'
current_price = 0
while 1
article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block;}
audio,canvas,video{display:inline-block;*display:inline;*zoom:1;}
audio:not([controls]){display:none;}
html{font-size:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;}
a:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px;}
a:hover,a:active{outline:0;}
sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline;}
sup{top:-0.5em;}
sub{bottom:-0.25em;}
img{max-width:100%;height:auto;border:0;-ms-interpolation-mode:bicubic;}
@FernandoEscher
FernandoEscher / RailsServerConfig_05_start_application
Created September 10, 2012 22:06
Server configuration for Rails: Start the application
# Create a symlink to the nginx bin file
sudo ln -s /opt/nginx/sbin/nginx /usr/local/sbin/
# Change the PID location
sudo vim /opt/nginx/conf/nginx.conf
pic /var/run/nginx.pid
# Go to the init.d folder
cd /etc/init.d/
@FernandoEscher
FernandoEscher / RailsServerConfig_04_web_server
Created September 10, 2012 21:55
Server configuration for Rails: Configuring the web server
# Enter the root account
sudo su
# Set your applications gemset
rvm gemset use MyAppName
# Install passenger
gem install passenger
# Install passenger module along with nginx
@FernandoEscher
FernandoEscher / RailsServerConfig_03_application_config
Created September 10, 2012 21:52
Server configuration for Rails: Configure the application
# Add your server's rsa public key to github (http://github.com/settings/ssh)
cat .ssh/id_MyAppName_rsa.pub
# Download your application to your home dir
git clone <repo>
# Enter your aplications folder
cd MyAppName/
# Go as root user
@FernandoEscher
FernandoEscher / RailsServerConfig_02_required_packages
Created September 10, 2012 21:51
Server configuration for Rails: Install required packages
# Install Git and Curl
sudo apt-get install git curl
# Install RVM from the website. It has to be Multiuser mode
curl -L https://get.rvm.io | sudo bash -s stable
# Add root and your user to the rvm group
sudo adduser root rvm
sudo adduser MyAppName rvm
@FernandoEscher
FernandoEscher / RailsServerConfig_01_admin_user
Created September 10, 2012 21:47
Server configuration for Rails: Creation of admin user.
# Some steps were taken from: http://blog.sofasurfer.org/2011/07/16/ubuntu-ec2-add-new-admin-user/
# Create new user and follow the steps
sudo adduser MyAppName
# Add the user to the admin group to have sudo access
sudo adduser MyAppName admin
# If you want to allow sudo access without password (Insecure)
sudo visudo
@FernandoEscher
FernandoEscher / alac2wav.sh
Created September 9, 2012 02:18
Convert recursively all the ALAC files to WAV
MAIN_DIR="parent/dir/here/" && for dir in "$MAIN_DIR"*/; do cd "$dir"; for f in *.m4a; do alac-decoder -v -f "$(basename "$f" .m4a).wav" "$f"; done; cd ..; done; && find "$MAIN_DIR" -name "*.m4a" -delete
@FernandoEscher
FernandoEscher / flac2ogg.sh
Created September 5, 2012 19:13
File splitter and converter from FLAC to OGG
#!/bin/bash
echo "Breacking file into tracks..."
cuebreakpoints *.cue | shnsplit -o flac *.flac
echo "Converting flac tracks to ogg quality 9..."
oggenc -q9 split-track*.flac
echo "Tagging files with info from the cue sheet..."
cuetag *.cue split-track*.ogg
sleep 7
echo "Renaming files according to tags..."
@FernandoEscher
FernandoEscher / ape2ogg.sh
Created September 5, 2012 19:12
File splitter and converter from APE to OGG
#!/bin/bash
echo "Breaking file into tracks..."
cuebreakpoints *.cue | shnsplit -o flac *.ape
echo "Converting flac tracks to ogg quality 9..."
oggenc -q9 split-track*.flac
echo "Tagging files with info from the cue sheet..."
cuetag *.cue split-track*.ogg
sleep 7
echo "Renaming files according to tags..."