Skip to content

Instantly share code, notes, and snippets.

View sideshowcoder's full-sized avatar
💭
🐱

Philipp Fehre sideshowcoder

💭
🐱
View GitHub Profile
#!/bin/bash
NOTIFY_FILE=~/.irssi/fnotify
# clear the file, at shutdown assuming we have showed all the notfications so
# far
trap "> $NOTIFY_FILE" SIGINT
# send notifications to the terminal-notifier
tail -f $NOTIFY_FILE | \
while read heading message; do
Outside in configuration
class ObjectBuilder
def initialize()
someMoreDefaults = {}
end
def setFoo foo
foo = foo
end
@sideshowcoder
sideshowcoder / .vimrc
Created December 9, 2014 17:42
Clear the vim quickfix list
function ClearQuickfixList()
call setqflist([])
endfunction
command! ClearQuickfixList call ClearQuickfixList()
nmap <leader>cf :ClearQuickfixList<cr>
@sideshowcoder
sideshowcoder / qad_notes.vim
Created December 8, 2014 22:04
Quick and Dirty Notes hack for Vim
map <leader>nn :edit ~/Dropbox/Notes/
function SearchNotes()
let search = input("Search Notes: ")
Ag search -f ~/Dropbox/Notes
endfunction
map <leader>sn :call SearchNotes()<cr>
@sideshowcoder
sideshowcoder / onenote_pdf2text.rb
Created December 8, 2014 21:40
OneNote to Text files
# Print OneNote to PDF
# Extract Text with
# http://www.extractpdf.com/ and name Main.txt
data = File.read "Main.txt"
data = data.split("\f")
data.each do |el|
next if el.empty?
if (null !== getenv("DATABASE_URL")) {
$db = parse_url(getenv("DATABASE_URL"));
define("DB_NAME", trim($db["path"],"/"));
define("DB_USER", $db["user"]);
define("DB_PASSWORD", $db["pass"]);
define("DB_HOST", $db["host"]);
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');
} else {
die("Your heroku DATABASE_URL does not appear to be correctly specified.");
require "dotenv/tasks"
require "uri"
namespace :development do
desc "run server"
task :server => :dotenv do
sh "php -S localhost:9292 "
end
desc "open a local database shell"
/**
* Functions to handle transition from Tumblr to Wordpress
* author: philipp fehre <philipp@fehre.co.uk
*
* The goal ist to make imported tumbler posts work along the normal permalinks
* generated by tumblr
*
* This works for posts imported via http://tumblr2wordpress.benapps.net
* exported file containing the tumblr post ids in the post_name field.
*/
#!/bin/bash
# Output is a script which installs all currently installed packages from
# homebrew, including those from tabs. Packages no longer available are ignored
# Usage:
# ./backup-homebrew.sh > my-homebrew-backup.sh
#
# warnings about packages not available anymore will be generated
#
@sideshowcoder
sideshowcoder / batch_insert.js
Last active September 1, 2017 12:14
Mass insert documents in Couchbase
var couchbase = require("couchbase")
var async = require("async")
var db = new couchbase.Connection({})
// create insert function which expects just a callback
function insertFormObject(object) {
return function (cb) {
db.set(object._id, object.value, cb)
}