Skip to content

Instantly share code, notes, and snippets.

View gudata's full-sized avatar
🏢
Working from office

gudata

🏢
Working from office
View GitHub Profile
@gudata
gudata / chef-swap.rb
Last active February 27, 2017 16:38 — forked from priestjim/chef-noatime-and-swap.rb
A quick (hacky) Chef recipe for adding noatime and a swap file in case a swap file does not exist
# Create and enable a swap file
have_file_swap = false
File.open('/etc/fstab',"r") do |fstab|
fstab.each do |line|
# Tokenize each fstab line with a space separator
tokens = line.split
if tokens[2] == "swap" && tokens[0] !~ /\/dev/
have_file_swap = true
@gudata
gudata / chef-noatime-and-swap.rb
Created February 27, 2017 16:29 — forked from priestjim/chef-noatime-and-swap.rb
A quick (hacky) Chef recipe for adding noatime and a swap file in case a swap file does not exist
# Enable noatime on local ext3/4 & xfs filesystems
fstab = File.open('/etc/fstab',"r")
newlines = Array.new
needremount = Array.new
ihaveswap = false
fstab.each do |line|
# Tokenize each fstab line with a space separator
tokens = line.split
if tokens[2] == "swap"
@gudata
gudata / chef-noatime-and-swap.rb
Created February 27, 2017 16:29 — forked from priestjim/chef-noatime-and-swap.rb
A quick (hacky) Chef recipe for adding noatime and a swap file in case a swap file does not exist
# Enable noatime on local ext3/4 & xfs filesystems
fstab = File.open('/etc/fstab',"r")
newlines = Array.new
needremount = Array.new
ihaveswap = false
fstab.each do |line|
# Tokenize each fstab line with a space separator
tokens = line.split
if tokens[2] == "swap"
@gudata
gudata / gource.sh
Created February 12, 2017 09:59 — forked from XueshiQiao/gource.sh
Generate a MP4 Video for your Git project commits using Gource!
# 1.install gource using HomeBrew
$ brew install gource
# 2.install avconv
git clone git://git.libav.org/libav.git
cd libav
# it will take 3-5 minutes to complie, be patient.
./configure --disable-yasm
make && make install
@gudata
gudata / introrx.md
Created November 19, 2016 14:02 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@gudata
gudata / no-graphic-boot
Created November 14, 2015 16:17 — forked from smoser/README.md
ubuntu-auto-install: install a ubuntu image with kvm
#!/bin/sh
set -e
echo blacklist vga16fb > /etc/modprobe.d/novga16fb.conf;
cat >> /etc/default/grub <<"EOF"
GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_TERMINAL=console
EOF
update-initramfs -u
update-grub
@gudata
gudata / rur_intro.rb
Last active August 29, 2015 14:20 — forked from kanmeiban/rur_intro.rb
# RUR (Relationally Universal Ruby) is a Ruby relational algebra DSL
# that compiles to SQL, allowing you to write complex
# queries without leaving your favorite language. It is going to be a nice
# Ruby-like replacement of SQL in the same manner CoffeeScript is a
# Ruby-like replacement of JavaScript. It will use all the features
# found in a modern RDBMS (views, temp views, constraints, triggers, functions,
# etc) without being tightly coupled to one particular implementation.
#
# Unlike ActiveRecord, which maps tables to classes, RUR maps relations to
# objects.
sudo add-apt-repository ppa:pitti/postgresql
sudo apt-get update
sudo apt-get install postgresql-9.2 postgresql-server-dev-9.2 postgresql-contrib-9.2
sudo su -l postgres
psql -d template1 -p 5433
CREATE EXTENSION IF NOT EXISTS hstore;
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
service postgresql stop
/usr/lib/postgresql/9.2/bin/pg_upgrade -b /usr/lib/postgresql/9.1/bin -B /usr/lib/postgresql/9.2/bin -d /var/lib/postgresql/9.1/main/ -D /var/lib/postgresql/9.2/main/ -O "-c config_file=/etc/postgresql/9.2/main/postgresql.conf" -o "-c config_file=/etc/postgresql/9.1/main/postgresql.conf"

This is how we test that all translation keys match up between locales.

Stuff that only goes in one locale (such as an admin section) or that can't be translated yet (if you use external translators) can simply go in files that don't match the path "config/locales/??.yml", like "config/locales/wip.fo.yml".

(Several of these git examples have been extracted from the book 'Pragmatic guide to GIT' of Travis Swicegood )

Git tips

Global git user

git config --global user.name "Fernando Guillen"
git config --global user.email "[email protected]"

Repository git user

cd /develop/myrepo