Skip to content

Instantly share code, notes, and snippets.

View mathieue's full-sized avatar

Mathieu Elie mathieue

View GitHub Profile
@mathieue
mathieue / VimLearningTodo
Created August 23, 2010 20:11
Vim Learning Todo
vim -p [filename] [filename] : open all files in tabs
:set syntax=perl : force syntax (usually taken from file extension)
* # g* g# : find word under cursor (<cword>) (forwards/backwards)
% : match brackets {}[]()
. : repeat last modification
<C-W><C-W> : switch vindow, very handy for split screen, quick fix..
<C-J> : join lines (current with following)
# warning order of json keys/values pairs could change on the twitter stream api,
# and you should modify the sed regexp
export TUSER=toto
export PASS=123456
curl -s -d 'track=google' http://stream.twitter.com/1/statuses/filter.json -u$TUSER:$PASS | sed 's/.*text":"\(.*\)","crea.*_name":"\(.*\)","name.*/\2\t\t\1/'
# command line can be amazing and so simple ( just a terminal! ) at the same time
# rsyncing to current dir as dest? watch dir size grows in real time!
watch -n 1 'du -sh .'
# cut word left of cursor
<ctrl-w>
# yank (paste) last cut/kill (ex: see <ctrl-w> )
<ctrl-y>
from django.conf import settings
from django.utils.translation import string_concat, ugettext_lazy
from django.utils.html import strip_tags
from haystack import indexes, site
from cms.models.managers import PageManager
from cms.models.pagemodel import Page
from cms.models.pluginmodel import CMSPlugin
python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"
#!/bin/bash
# Shell script to backup MySql database
# To backup Nysql databases file to /backup dir and later pick up by your
# script. You can skip few databases from backup too.
# For more info please see (Installation info):
# http://www.cyberciti.biz/nixcraft/vivek/blogger/2005/01/mysql-backup-script.html
# Last updated: Aug - 2005
# --------------------------------------------------------------------
# This is a free shell script under GNU GPL version 2.0 or above
# Copyright (C) 2004, 2005 nixCraft project
@mathieue
mathieue / startvm.sh
Created August 4, 2011 20:10
start a virtualboxvm in headless mode, only in a term
#!/bin/bash
# vmmacbook is the name of my vm
VBoxHeadless -startvm vmmacbook
#!/bin/bash
ssh mathieu@127.0.0.1 -p 2222 sudo halt -n
@mathieue
mathieue / rmvm-system-wide.sh
Created September 9, 2011 21:23
System wide RVM
sudo su
bash <<(curl -s https://rvm.beginrescueend.com/install/rvm)
apt-get install zlib1g-dev libssl-dev libreadline5-dev
rvm install 1.9.2
rvm 1.9.2
add rvm script below to your .bashrc and to /root/.bashrc
# Load RVM if it is installed,
# first try to load user install
# then try to load root install, if user install is not there.
require 'couchrest'
class CouchWarmer
# database = 'http://127.0.0.1:5984/dbname'
def initialize(database)
@db = CouchRest.database!(database)
end
# name with suffix, suffix
def warm(name, suffix)