Skip to content

Instantly share code, notes, and snippets.

@miebach
miebach / Install nodejs as service
Created May 31, 2012 16:04
Install nodejs as a service on windows
1) Download nssm from http://nssm.cc/download/?page=download and extract nssm.exe, for example to %windir%\system32\
2) Install your service:
nssm.exe install my-node-service c:\programs\nodejes\node.exe c:\my\server.js
3) Start it using net start:
net start my-node-service
@miebach
miebach / freeport.py
Created May 18, 2012 16:50
Experimental python script to kill processes on unix-like systems.
#!/usr/bin/python -W ignore::DeprecationWarning
import sys
import os
"""
Experimental python script to kill processes on unix-like systems.
https://gist.github.com/2726360
Looks for all established connections on a given port and kills their processes.
@miebach
miebach / run_debugger.sh
Created May 3, 2012 20:16
python debugging from the commandline
python -m dbg codefile.py
@miebach
miebach / 10.04.sh
Created April 18, 2012 22:26
some basic steps on a new minimal ubuntu system
locale-gen en_US.UTF-8
locale-gen de_DE.UTF-8
/usr/sbin/update-locale LANG=en_US.UTF-8
dpkg-reconfigure tzdata
aptitude update
aptitude safe-upgrade
@miebach
miebach / openerp-server-kill.sh
Created April 12, 2012 16:24
Kill openerp 6.1 server by pid
#!/bin/sh
kill -9 `ps au|grep 6.1|grep -v "grep"| awk '{print $2}'`
@miebach
miebach / install_riak.sh
Created April 8, 2012 22:41 — forked from lanius/install_riak.sh
Install riak 1.1.2 and R14B03 on a minimal Ubuntu 10.04 LTS server
# Install riak-0.14.2rc8 to Ubuntu 10.04 LTS 32 bit
# make sure you have a compatible build system and the ncurses and openssl
# development libraries installed, also git and curl:
sudo aptitude install build-essential libncurses5-dev openssl libssl-dev git-core curl -y
# download, build and install Erlang:
ERLANG=/opt/erlang
@asabaylus
asabaylus / git-vlog
Last active June 21, 2022 20:45
Git visual log for the console
# Git visual log displays commit tree view with who did what when and in which branch
git config --global alias.vlog 'log --graph --date-order --date=relative --pretty=format:"%C(cyan)%h: %Cblue - %an - %Cgreen %C(cyan)%ar:%Creset%n%s%n" --color'
@miebach
miebach / docprint.py
Created November 2, 2011 17:54
docprint - python helper function to print to sys.stderr
import sys
"""
Save this file as c:\Python24\Lib\docprint.py or in your application or library directory.
File is maintained as a gist at github: https://gist.github.com/1334355
"""
def write(txt):
@miebach
miebach / dump_object.py
Created October 16, 2011 15:42
Python debugging and inspection: print (or return as string) a nicely formatted overview of a python object. Works on a module, class or instance.
# recipe-137951-1.py
# from http://code.activestate.com/recipes/137951-dump-all-the-attributes-of-an-object/
# created by (C) Philip Kromer http://code.activestate.com/recipes/users/552075/
# forked as https://gist.github.com/1291055
# licence = psf http://code.activestate.com/recipes/tags/meta:license=psf/
# On python attributes and methods read: http://www.cafepy.com/article/python_attributes_and_methods/python_attributes_and_methods.html
from cStringIO import StringIO
import sys
@miebach
miebach / mysql_test_db_connection.php
Created October 7, 2011 11:45
Testing MySQL connection and select DB with PHP
<?php
echo "Connecting to MySQL Server ... ";
mysql_connect(
"localhost",
"admin",
"pass123")
or die(mysql_error());
echo "[OK]<br />";