Skip to content

Instantly share code, notes, and snippets.

View madx's full-sized avatar

François Vaux madx

View GitHub Profile
@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 / 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
#!/bin/bash
DNS="$(cat /etc/resolv.conf)"
cp -f /etc/resolv.conf.head /etc/resolv.conf
echo "$DNS" >> /etc/resolv.conf
@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
# 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 / 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"
@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
module DataAPI
class Application < ActiveRecord::Base
# Validations ...
attr_accessible :name, :domain, :description
has_many :rooms, dependent: :destroy
end
@madx
madx / Instructions.mkd
Created February 23, 2012 15:10
Syslog Viewer

Instructions

MySQL

Create a MySQL database named syslog and a table called events (you may run the app once to automatically create the table). For rsyslog, you may use something like this :

@madx
madx / touchpad_toggle.sh
Created February 25, 2011 09:51
Toggles the touchpad state using xinput
#!/bin/bash
prop="Device Enabled"
id="$(xinput list | grep -i touchpad | sed 's/.*id=\([0-9]\+\).*/\1/')"
state="$(xinput list-props $id | grep "$prop" | cut -d: -f2 | sed 's/\s//g')"
if [ "$state" = 1 ]; then
xinput --set-prop $id "$prop" 0
else