Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env php
<?php
$dir = "/tmp/phpmails";
if (!is_dir($dir)) {
mkdir($dir);
}
$input = file_get_contents('php://stdin');
preg_match('|^To: (.*)|', $input, $matches);
$filename = isset($matches[1]) ? $matches[1] . '_' : 'no-recepient_';
$t = tempnam($dir, $filename);
#!/usr/bin/env ruby
require 'cgi'
require ENV['TM_SUPPORT_PATH'] + '/lib/escape'
FILEPATH = ENV['TM_FILEPATH']
lint = `~/Library/JSLint/jslint.sh`
lint.gsub!(/^Lint at line (\d*) character (\d*):(.+?)\n(?:(.+?)\n\n)?/m) do
"<p><span>Lint at <a href=\"txmt://open?url=file://#{e_url FILEPATH}&line=#{$1}&column=#{$2}\">line #{CGI.escapeHTML($1)}</a>:</span><span class=\"message\">#{CGI.escapeHTML($3)}<span></p>" <<
#!/bin/sh
repo="`pwd`"
export GIT_DIR="$repo"
wd="`dirname $repo`"
echo "$repo"
echo "$wd"
cd "$wd"
git merge master
git submodule init
<?php
/**
* Override theme_block() to disable rendering of blocks.
*/
function YOURTHEME_blocks($region) {
$output = '';
// Right region and on the node form.
$node_form = ($region == 'right' && arg(0) == 'node' && (arg(1) == 'add' || arg(2) == 'edit'));
if (!$node_form) {
<?php
function sbm_upgrade_install() {
// Install modules that were enabled on the D5 site and should be enabled
// here too. Make sure that dependent modules are listed after dependencies.
drupal_install_modules(array(
'content',
'optionwidgets',
'text',
'content_copy',
'emfield',

Apps

Se http://goodold.se/blog/tech/git-workflow-going-live för allmän info.
Specifikt för Ostnet:
Lägga upp SSH-nyckel:
$ scp ~/.ssh/goodold_rsa.pub root@vps-XXXX.cloudnet.se:~/goodold_rsa.pub
-enter password
$ ssh root@vps-XXXX.cloudnet.se
-enter password
$ cat goodold_rsa.pub >> /mnt/persist/cloudnet/ssh_public_keys
// ==UserScript==
// @name Localhost
// @namespace GoodOld
// @include http://*.local/
// ==/UserScript==
/*
Displays a bagde when surfing .local pages.
*/
// ==UserScript==
// @name Localhost
// @namespace Perifer
// @include http://*.local/*
// ==/UserScript==
(function() {
div = document.createElement("div");
div.innerHTML = '<style type="text/css" media="screen">#LocalBadge{position:fixed;right:-45px;top:-25px;z-index:99999} #LocalBadge > div{font:15px/17px Helvetica,Arial,sans-serif;-webkit-transform:rotate(45deg);-webkit-transform-origin:0 0;-webkit-box-shadow:0 0 5px #000;-moz-transform:rotate(45deg);-moz-transform-origin:0 0;-moz-box-shadow:0 0 5px #000;background:#222;background:-webkit-gradient(linear,left top,left bottom,from(#444),to(#222));width:70px;padding-top:15px;text-align:center;color:#E458B4;}</style><div id="LocalBadge"><div>local</div></div>';
document.body.appendChild(div);
# Place the following at the end of ~/.profile:
# if [ -f ~/.ostnet_profile ]; then
# source ~/.ostnet_profile
# fi
# Remove duplicates from history.
export HISTCONTROL=erasedups
# Aliases
alias ls="ls -al --color=auto"