Skip to content

Instantly share code, notes, and snippets.

View pstaender's full-sized avatar
👾
extra terrestrial

Philipp Staender pstaender

👾
extra terrestrial
  • Cologne, Germany
View GitHub Profile
ffmpeg -i input.webm -acodec libmp3lame -aq 4 output.mp3
@pstaender
pstaender / php-fastcgi.sh
Created May 17, 2013 20:57
start/stop script for php fastcsgi taken from http://www.networkinghowtos.com/howto/ubuntu-php-fastcgi-init-script/ /etc/init.d/php-fastcgi chmod +x /etc/init.d/php-fastcgi update-rc.d php-fastcgi defaults /etc/init.d/php-fastcgi starta
#! /bin/sh
### BEGIN INIT INFO
# Provides: php-fastcgi
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start and stop php-cgi in external FASTCGI mode
# Description: Start and stop php-cgi in external FASTCGI mode
### END INIT INFO
@pstaender
pstaender / tiny_logger.coffee
Last active December 17, 2015 16:59
Tiny logger
log = ->
currentTime = -> new Date().toString().replace(/^([a-z]+[\,\s]*?)([a-z].+)(GMT.*?)$/i,'$2').trim()
_toS = (o) ->
if typeof o is 'function'
String(o.constructor)
else if typeof o is 'object' then JSON.stringify(o) else String(o)
args = Array::slice.call(arguments)
@pstaender
pstaender / config.coffee
Last active December 17, 2015 16:59
Merging of environments in config.yml including a getter to access config values by string
require('js-yaml')
data = require('./config.yml')
_ = require('underscore')
defaultEnv = 'development'
env = process.env.NODE_ENV or
config = _.extend(data[defaultEnv], data[env] or {})
{exec} = require('child_process')
version_hash = null
exec 'git rev-parse HEAD', (err,output) ->
# get revision hash from git and strip whitespaces
version_hash = if output then output.replace(/\s/g, '') else null
# uesed as default for mongoose
versionHash = -> version_hash
@pstaender
pstaender / summarize.coffee
Last active December 18, 2015 03:48
Summarizes plain text by taking the first sentence of each paragraph and additionally the last sentence of the last paragraph.
###
The MIT License (MIT)
Copyright © 20130 Philipp Staender <philipp.staender@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@pstaender
pstaender / pstaender.zsh-theme
Last active December 25, 2015 10:29
~/.oh-my-zsh/themes/pstaender.zsh-theme
#!/usr/bin/env zsh
setopt promptsubst
autoload -U add-zsh-hook
PROMPT_SUCCESS_COLOR=$FG[117]
PROMPT_FAILURE_COLOR=$FG[124]
PROMPT_VCS_INFO_COLOR=$FG[242]
PROMPT_PROMPT=$FG[077]
@pstaender
pstaender / remove_pdf_password.sh
Created November 11, 2013 12:07
Remove password from protected PDF file with GhostScript
gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=unencrypted.pdf -c .setpdfwrite -f encrypted.pdf
@pstaender
pstaender / import.js
Created December 5, 2013 12:55
Import script for neo4jmapper
var Neo4jMapper = require('neo4jmapper');
var neo4j = null;
var JSONStream = require('JSONStream');
var sequence = require('futures').sequence.create();
var out = function(s) {
console.log(s);
}
@pstaender
pstaender / export.js
Last active December 30, 2015 08:48
Export script for neo4jmapper
var Neo4jMapper = require('neo4jmapper');
var neo4j = null;
var out = function(s) { console.log(s); }
var e = function(s) { process.stderr.write(s); }
try {
neo4j = new Neo4jMapper(process.argv[2]);
} catch (e) {
console.error(e.message);