Skip to content

Instantly share code, notes, and snippets.

View madx's full-sized avatar

François Vaux madx

View GitHub Profile
module DataAPI
class Application < ActiveRecord::Base
# Validations ...
attr_accessible :name, :domain, :description
has_many :rooms, dependent: :destroy
end
@madx
madx / LICENSE
Created April 5, 2012 09:16
Managing your identity in Git
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2012 François Vaux <[email protected]>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@madx
madx / irsay.sh
Last active April 2, 2019 22:51
A minimalist IRC client in Bash. Could also be used as a bot.
#!/bin/bash
[ -z "$channel" ] && channel="#bobot"
[ -z "$server" ] && server="irc.freenode.net"
[ -z "$port" ] && port="6667"
[ -z "$user" ] && user=$USER
function irc_session () {
# Login phase
echo "USER $user 0 * :$user"
echo "NICK $user"
#!/bin/bash
# A small example program for using the new getopt(1) program.
# This program will only work with bash(1)
# An similar program using the tcsh(1) script language can be found
# as parse.tcsh
# Example input and output (from the bash prompt):
# ./parse.bash -a par1 'another arg' --c-long 'wow!*\?' -cmore -b " very long "
# Option a
@madx
madx / Gemfile
Created December 19, 2012 09:00
This is the Rakefile I use to generate my personal website (http://madx.me)
source 'https://rubygems.org/'
gem "rake"
gem "haml"
gem "redcarpet"
gem "albino"
group :development do
gem "sass"
end
#!/bin/bash
DNS="$(cat /etc/resolv.conf)"
cp -f /etc/resolv.conf.head /etc/resolv.conf
echo "$DNS" >> /etc/resolv.conf
@madx
madx / inotify-watcher.sh
Last active December 11, 2015 10:09
Simple file event watching using inotifywait
inotifywait -qm -e CLOSE_WRITE file.haml | while read ev; do
haml file.haml file.html
done
# use -r on inotifywait to watch directories recursively
@madx
madx / master-window.vim
Created January 23, 2013 09:33
This is how I manage my windows in Vim. You may also be interested in dwm.vim (https://github.com/spolu/dwm.vim)
" Put this in .vim/bundle/master-window/plugin/ if you are using Pathogen
" Figure out a way to get this loaded if you aren't
if exists("master_window_loaded")
finish
endif
let master_window_loaded = 1
function! FocusMasterWindow()
exe "1wincmd w"
@madx
madx / mouse-selection.vim
Created February 6, 2013 13:16
Using Alt+Mouse for block selection and Shift+Mouse for line selection in Vim
" Block/Line selection with mouse
noremap <M-LeftMouse> <4-LeftMouse>
inoremap <M-LeftMouse> <4-LeftMouse>
onoremap <M-LeftMouse> <C-C><4-LeftMouse>
noremap <M-LeftDrag> <LeftDrag>
inoremap <M-LeftDrag> <LeftDrag>
onoremap <M-LeftDrag> <C-C><LeftDrag>
noremap <S-LeftMouse> <3-LeftMouse>
inoremap <S-LeftMouse> <3-LeftMouse>
pidenv() {
local pid="$1"
tr '\000' '\n' < /proc/$pid/environ
}