This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on several guides, primarily: | |
# http://ninetynine.be/blog/2009/03/ubuntu-backup-to-usb-drive-on-mount/ | |
# /etc/udev/rules.d/81-local.rules | |
ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="…", ATTRS{idProduct}=="…", RUN+="/usr/bin/truecrypt_mount.sh" | |
ACTION=="remove", SUBSYSTEMS=="usb", ATTRS{idVendor}=="…", ATTRS{idProduct}=="…", RUN+="/usr/bin/truecrypt_unmount.sh" | |
# /usr/bin/truecrypt_mount.sh | |
truecrypt /dev/disk/by-id/… -k … --protect-hidden=no --password= /mnt/houdini/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements hook_form_alter(). | |
* | |
* Redirects user logins to the front page. | |
*/ | |
function HOOK_form_user_login_alter(&$form, &$form_state) { | |
$form['#action'] = url('user', array('query' => array('destination' => '<front>'))); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Logic stolen from https://github.com/gf3/dotfiles | |
parse_git_dirty() { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" | |
} | |
parse_git_branch() { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/" | |
} | |
prompt_desc() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# $HOME/bin/track | |
# Put the following exports in your .profile | |
# export TRACK_SSH="ssh genero" # Local host only | |
# export TRACK_LOG_FILE="$HOME/.timetracker.log" # Should exist on all hosts | |
if [[ "$TRACK_SSH" ]]; then log_content="$TRACK_SSH cat \$TRACK_LOG_FILE" | |
else log_content="cat $TRACK_LOG_FILE"; fi | |
output() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! SetWPConfig () | |
setlocal shiftwidth=4 softtabstop=4 tabstop=4 noexpandtab | |
setlocal listchars=trail:· | |
endfunction | |
function! SetDrupalConfig () | |
setlocal shiftwidth=2 softtabstop=2 tabstop=2 expandtab | |
setlocal listchars=tab:▸\ ,trail:· | |
endfunction | |
" Wordpress files |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/expect -f | |
# Usage: | |
# ./ssh.exp USER PASS IDENTITY_FILE HOST COMMAND | |
set username [lrange $argv 0 0] | |
set password [lrange $argv 1 1] | |
set identity_file [lrange $argv 2 2] | |
set host [lrange $argv 3 3] | |
set command [lrange $argv 4 4] | |
set timeout -1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$view = views_get_view('news'); | |
$view->set_display('block_1'); | |
if (!in_array($language->language, array('fi', 'sv'))) { | |
$view->set_item('block_1', 'filter', 'language_2', NULL); | |
$view->add_item('block_1', 'filter', 'node', 'language', array('value' => array('value' => 'fi'))); | |
} | |
$previous_articles = $view->render(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir phpMyAdmin && wget https://github.com/phpmyadmin/phpmyadmin/tarball/RELEASE_3_4_10_1 -O - | tar xzv --directory=phpMyAdmin --strip-components 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! DrupalImplementsComment () | |
let filename = bufname("%") | |
let dot = stridx(filename, ".") | |
let module = strpart(filename, 0, dot) | |
let current_line = getline(".") | |
let hook_idx = matchend(current_line, "function " . module . "_") | |
if !empty(module) && hook_idx != -1 | |
let hook_length = match(current_line, "(") - hook_idx | |
let hook_name = strpart(current_line, hook_idx, hook_length) | |
call DoxygenComment ("Implements hook_" . hook_name . "().") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/vimrc b/vimrc | |
index c90fb0c..a81f505 100644 | |
--- a/vimrc | |
+++ b/vimrc | |
@@ -14,7 +14,7 @@ call pathogen#infect() | |
set shiftwidth=2 " auto-indent amount when using cindent, etc | |
set softtabstop=2 " how many spaces is a tab | |
-set tabstop=4 " real tabs should be 4 | |
+set tabstop=2 " real tabs should be 4 |
OlderNewer