Skip to content

Instantly share code, notes, and snippets.

@rafaelrosafu
rafaelrosafu / gist:9194961
Created February 24, 2014 19:18
Sylvain's colors
source ~/.bash/system
PREFIX="${debian_chroot:+($debian_chroot)}${BGreen}${Username}${BBlue}@${Color_Off} ${IBlack}${Time24h}${Color_Off} "
SUFFIX="${BYellow}${PathShort}${Color_Off}"
PROMPT_ORDER=(window_title vcs_pre PREFIX virtualenv vcs_prompt SUFFIX PromptSymbol Space)
@rafaelrosafu
rafaelrosafu / python_provisioner.sh
Last active August 29, 2015 14:02
Python environment provisioner on a Ubuntu machine. I recommend combining it with Vagrant
#!/bin/sh
# This script can be run by:
# curl <raw text URL> | sh
# Installing basic packages
sudo apt-get install -y python-pip python-dev build-essential ipython-notebook
sudo pip install --upgrade pip
sudo pip install --upgrade virtualenv
@rafaelrosafu
rafaelrosafu / keybase.md
Created January 26, 2015 19:11
Keybase.io identity proof

Keybase proof

I hereby claim:

  • I am rafaelrosafu on github.
  • I am rafaelrosafu (https://keybase.io/rafaelrosafu) on keybase.
  • I have a public key whose fingerprint is 1BF4 D4F7 E3EE AEEA 36AF 2D76 0E8D EC06 77F1 6DD1

To claim this, I am signing this object:

@rafaelrosafu
rafaelrosafu / gist:1325356
Created October 30, 2011 01:46
Migrating WP with latin symbols convertion
# Good reference
http://en.gentoo-wiki.com/wiki/Convert_latin1_to_UTF-8_in_MySQL
## On the original server on Dreamhost
# Backup the database, pay special attention to character set
mysqldump --user=grokpodcastcom -p --host=mysql.grokpodcast.com --default-character-set=latin1 -c --insert-ignore --skip-set-charset -r dump_grok.sql grokpodcast_com
# The sed replaces the WP instance prefix on the database and also it's name
sed -i 's/_5cweix_/_/' dump_grok.sql
sed -i 's/grokpodcast_com/bitnami_wordpress/' dump_grok.sql
# Put dump on S3 (easier than FTP)
@rafaelrosafu
rafaelrosafu / fabrication_devise.rb
Created December 23, 2011 01:27
How to fix problems using Devise, factories and Capybara + regular specs
# Avoid problems when running Capybara specs before regular ones, and fix the
# "Could not find a valid mapping for X". Part of the solution is to use the
# Devise test helpers as explained on link A, but then you need to clear the
# fabricated objects, as explained on link B. Here's the equivalent code when
# using the Fabrication gem
#
# A - http://stackoverflow.com/questions/4230152/mocks-arent-working-with-rspec-and-devise
# B - http://stackoverflow.com/questions/6363471/could-not-find-a-valid-mapping-for-user-only-on-second-and-successive-t
if Rails.env.development? || Rails.env.test?
ActionDispatch::Callbacks.after do
@rafaelrosafu
rafaelrosafu / Vagrantfile
Last active December 14, 2015 04:49
Vagrant config template
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
# precise-cloudimage is an official Ubuntu image at http://cloud-images.ubuntu.com/vagrant/
@rafaelrosafu
rafaelrosafu / gist:5384508
Last active December 16, 2015 05:29
Installing jasmine headless on Ubuntu 12.04
sudo apt-get install libqt4-dev libicu48 xvfb
On Gemfile:
gem 'jasmine-headless-webkit'
On .gitignore:
.jhw-cache/
bundle install --path=vendor --binstubs
@rafaelrosafu
rafaelrosafu / instructions.md
Last active December 17, 2015 19:09
Compile and Install Heka on Centos 6.4

More info on http://hekad.readthedocs.org/en/latest/installing.html

Build and test hekad

yum install git gcc patch python-devel
rpm -ihv http://pkgs.repoforge.org/cmake/cmake-2.8.8-1.el6.rfx.x86_64.rpm

git clone git@github.com:mozilla-services/heka-build.git
cd heka-build
@rafaelrosafu
rafaelrosafu / install.sh
Created June 26, 2013 05:52
Setup sshd on a docker image. You can't run daemons inside docker https://github.com/dotcloud/docker/issues/446#issuecomment-16710461, or at least not manually, looks like lxc-execute can do the trick http://lxc.sourceforge.net/man/lxc-execute.html
apt-get install openssh-server
mkdir /var/run/sshd
sed -i 's/#AuthorizedKeysFile/AuthorizedKeysFile/' /etc/ssh/sshd_config
# run as foreground process
/usr/sbin/sshd -D