Skip to content

Instantly share code, notes, and snippets.

View agebrock's full-sized avatar

Christoph Hagenbrock agebrock

View GitHub Profile
@agebrock
agebrock / pRequest.js
Created August 14, 2014 11:46
create a express / http request programmatically
var http = require('http');
//reuse express server
var server = app.listen(3333);
//create server
//var server = http.createServer(app);
function request(server){
@agebrock
agebrock / check_command
Created June 27, 2013 03:10
check for commands
my_needed_commands="sed awk lsof who"
missing_counter=0
for needed_command in $my_needed_commands; do
if ! hash "$needed_command" >/dev/null 2>&1; then
printf "Command not found in PATH: %s\n" "$needed_command" >&2
((missing_counter++))
fi
done
@agebrock
agebrock / mysql_start.sh
Created July 14, 2012 20:14
mysql: start service
sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
@agebrock
agebrock / gist:3100356
Created July 12, 2012 19:31 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@agebrock
agebrock / res.js
Created July 1, 2012 17:08
posted from brackets
var AssetGraph = require('assetgraph');
var nib = require("nib");
module.exports.task = function (packageName ){
new AssetGraph({root: __dirname + "/src/" + packageName+ "/"})
.loadAssets("templates/*/**.css")
.loadAssets('templates/**.html')
.loadAssets('templates/*/**.styl')
.loadAssets('templates/*/**.less')
@agebrock
agebrock / install_formula.sh
Created June 17, 2012 06:02
php-fpm via homebrew
curl -O https://raw.github.com/ampt/homebrew/php/Library/Formula/php.rb
mv php.rb `brew --prefix`/Library/Formula
#To see the available options:
brew options php
brew install php --with-mysql --with-fpm
@agebrock
agebrock / convertDataURIToBlob.js
Created May 13, 2012 17:34
function convertDataURIToBlob(dataURI, mimetype) // blogBuilder (chrome)
This has worked for me in the past:
function convertDataURIToBlob(dataURI, mimetype) {
var BASE64_MARKER = ';base64,';
var base64Index = dataURI.indexOf(BASE64_MARKER) + BASE64_MARKER.length;
var base64 = dataURI.substring(base64Index);
var raw = window.atob(base64);
var rawLength = raw.length;
var uInt8Array = new Uint8Array(rawLength);
for (var i = 0; i < rawLength; ++i) {
@agebrock
agebrock / gist:2668201
Created May 12, 2012 18:55
secure ssh
sudo vi /etc/ssh/sshd_config
And change the following values:
Port 2207
...
PermitRootLogin no
...
AllowUsers myuser git
...
PasswordAuthentication no
@agebrock
agebrock / installNginx.sh
Created April 8, 2012 20:33
roll your own nginx
apt-get update
apt-get upgrade --show-upgraded
apt-get install libpcre3-dev build-essential libssl-dev
cd /opt/
wget http://nginx.org/download/nginx-1.0.4.tar.gz
tar -zxvf nginx-1.0.4.tar.gz
cd /opt/nginx-1.0.4/
./configure --prefix=/opt/nginx --user=nginx --group=nginx --with-http_ssl_module --with-ipv6
#!/bin/sh
#
# <daemonname> <summary>
#
# chkconfig: <default runlevel(s)> <start> <stop>
# description: <description, split multiple lines with \
# a backslash>
### BEGIN INIT INFO
# Provides: