most of these require logout/restart to take effect
# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false
# Keyboard repeat
<?php | |
function TimeAgo($datefrom, $dateto = -1) | |
{ | |
if ($datefrom <= 0) { | |
return "A long time ago"; | |
} | |
if ($dateto == -1) { | |
$dateto = time(); | |
} |
#!/bin/bash | |
# create ipPod audiobook from group of sequentially named MP3 files | |
# Set environmental variables for track ID3 tags | |
# AUTHOR, TITLE, YEAR | |
# usage: create_audiobook | |
# | |
# Pass output filename on command-line with no extension, and use quotes if there are spaces in filenames | |
# e.g. create_audiobook "Terry Pratchett - Colour of Magic" *.mp3 | |
# e.g. create_audiobook "Terry Pratchett - Colour of Magic" “Terry Pratchett - Colour of Magic - *.mp3″ |
// Fixes Home and End keys in Sublime Text 2 | |
[ | |
{ "keys": ["end"], "command": "move_to", "args": {"to": "eol"} }, | |
{ "keys": ["home"], "command": "move_to", "args": {"to": "bol"} }, | |
{ "keys": ["shift+end"], "command": "move_to", "args": { "to": "eol", "extend": true } }, | |
{ "keys": ["shift+home"], "command": "move_to", "args": { "to": "bol", "extend": true } } | |
] |
function sopac_subaccounts_confirm_remove_submit($form, &$form_state) { | |
$account = $form_state['values']['account']; | |
$subID = $form_state['values']['subID']; | |
$sub_cards = explode(',', $account->profile_pref_additional_cardnum); | |
$removed_card = $sub_cards[$subID]; | |
unset($sub_cards[$subID]); | |
$update = array( | |
'profile_pref_additional_cardnum' => implode(',', $sub_cards), | |
'profile_pref_cardnum' => $account->profile_pref_cardnum, |
#!/bin/sh | |
# | |
# Totally basic script to rip audiobook CDs into a single file. | |
# I then use Audiobookbinder to create .m4b files so I can listen to them | |
# on my iPhone | |
# | |
# You'll need to: | |
# brew install cdparanoia | |
# brew install shntool | |
# brew install lame |
charset_table = 0..9, a..z, _, A..Z->a..z, U+00C0->a, U+00C1->a, U+00C2->a, U+00C3->a, U+00C4->a, U+00C5->a, U+00C7->c, U+00C8->e, U+00C9->e, U+00CA->e, U+00CB->e, U+00CC->i, U+00CD->i, U+00CE->i, U+00CF->i, U+00D1->n, U+00D2->o, U+00D3->o, U+00D4->o, U+00D5->o, U+00D6->o, U+00D8->o, U+00D9->u, U+00DA->u, U+00DB->u, U+00DC->u, U+00DD->y, U+00E0->a, U+00E1->a, U+00E2->a, U+00E3->a, U+00E4->a, U+00E5->a, U+00E7->c, U+00E8->e, U+00E9->e, U+00EA->e, U+00EB->e, U+00EC->i, U+00ED->i, U+00EE->i, U+00EF->i, U+00F1->n, U+00F2->o, U+00F3->o, U+00F4->o, U+00F5->o, U+00F6->o, U+00F8->o, U+00F9->u, U+00FA->u, U+00FB->u, U+00FC->u, U+00FD->y, U+00FF->y, U+0100->a, U+0101->a, U+0102->a, U+0103->a, U+0104->a, U+0105->a, U+0106->c, U+0107->c, U+0108->c, U+0109->c, U+010A->c, U+010B->c, U+010C->c, U+010D->c, U+010E->d, U+010F->d, U+0112->e, U+0113->e, U+0114->e, U+0115->e, U+0116->e, U+0117->e, U+0118->e, U+0119->e, U+011A->e, U+011B->e, U+011C->g, U+011D->g, U+011E->g, U+011F->g, U+0120->g, U+0121->g, U+0122->g, U+0123->g |
#include <unistd.h> | |
#include <errno.h> | |
main( int argc, char ** argv, char ** envp ) | |
{ | |
if( setgid(getegid()) ) perror( "setgid" ); | |
if( setuid(geteuid()) ) perror( "setuid" ); | |
envp = 0; /* blocks IFS attack on non-bash shells */ | |
system( "/path/to/bash/script", argv, envp ); | |
perror( argv[0] ); |
$year = date('Y'); | |
$week_no = date('W'); | |
$week_start = new DateTime(); | |
$week_start->setISODate($year, $week_no); | |
echo $week_start->format('l jS F (Y-m-d)'); // Monday for the current week | |
// Gets the week range for given date YYYY-MM-DD | |
function rangeWeek($datestr) { |
<?php | |
/* | |
|-------------------------------------------------------------------------- | |
| Sharing Laravel's session and checking authentication | |
|-------------------------------------------------------------------------- | |
| | |
| Customized Moxiemanager plugin for use in our Laravel App. We use a custom | |
| External authentication module, but you get the gist (ha ha) of it. | |
| Put the Plugin.php file in moxiemanager/plugins/LaravelAuthenticator |