Skip to content

Instantly share code, notes, and snippets.

View nicholassm's full-sized avatar

Nicholas Schultz-Møller nicholassm

View GitHub Profile
@Darksecond
Darksecond / nginx.conf
Created October 8, 2012 20:24
Systemd + Unicorn + Nginx + no-downtime-reload
# The only setting we feel strongly about is the fail_timeout=0
# directive in the "upstream" block. max_fails=0 also has the same
# effect as fail_timeout=0 for current versions of nginx and may be
# used in its place.
# you generally only need one nginx worker unless you're serving
# large amounts of static files which require blocking disk reads
worker_processes 1;
# # drop privileges, root is needed on most systems for binding to port 80
@alegomes
alegomes / iconv
Created May 27, 2012 00:28
Converting unknown charset file to UTF-8
I had a dataset but it was not UTF-8. So, I had to find out which charset was being used. 'file' command didn't helped me out.
$ file file_name.csv
file_name.csv: Non-ISO extended-ASCII C++ program text, with very long lines, with CRLF line terminators
So, I made this bash script to figure out its encoding:
First, I converted the file to every single format available by 'iconv':
$ for f in $(iconv -l); do echo "Convertendo $f ..."; iconv -f $f -t UTF-8 < file_name.csv > fil_name.$f.csv; done
@pixeltrix
pixeltrix / routes.rb
Created October 29, 2010 13:21
Examples of advanced Rails 3.0 routes
Rails.application.routes.draw do
get '/(:locale)/products/(:category)/(page/:page).:extension',
:to => 'products#index',
:as => :products,
:constraints => {
:locale => /[a-z]{2}/,
:category => /.+?/,
:page => /\d+/
},