Skip to content

Instantly share code, notes, and snippets.

View Finkregh's full-sized avatar
🚲

Oluf Lorenzen Finkregh

🚲
View GitHub Profile
@Finkregh
Finkregh / mysql-recursive-convert-collation.php
Created May 20, 2011 11:54
convert all collations (tables and rows) in a MySQL-DB to utf-8
<?php
// your connection
mysql_connect("localhost","root","");
mysql_select_db("");
// convert code
$res = mysql_query("SHOW TABLES");
while ($row = mysql_fetch_array($res))
{
foreach ($row as $key => $table)
@Finkregh
Finkregh / Debianize-Git-Jenkins
Created September 14, 2011 13:21 — forked from jeffery/Debianize-Git-Jenkins
Trigger the build of a debian package for a Git SCM project via Jenkins CI
#!/bin/bash
#
# This is a helper script to trigger the build of a debian package for a
# project which is in Git SCM and integrated via Jenkins CI
#
# The trigger used for the package build is a string "bump for release"
# which is part of the commit message for the Git repository.
#
# The Changelog is then parsed to obtain the release version and then
# the repository is exported for package building
@Finkregh
Finkregh / Debianize-Git-Jenkins
Created December 29, 2011 10:51 — forked from jeffery/Debianize-Git-Jenkins
Trigger the build of a debian package for a Git SCM project via Jenkins CI
#!/bin/bash
#
# This is a helper script to trigger the build of a debian package for a
# project which is in Git SCM and integrated via Jenkins CI
#
# The trigger used for the package build is a string "bump for release"
# which is part of the commit message for the Git repository.
#
# The Changelog is then parsed to obtain the release version and then
# the repository is exported for package building
@Finkregh
Finkregh / ideal ops.md
Created May 31, 2012 06:37 — forked from bhenerey/ideal ops.md
ideal ops checklist

In a perfect world, where things are done well, not just quickly, I would expect to find the following when joining the company:

Documentation

  • Accurate / up-to-date systems architecture diagram

  • Accurate / up-to-date network diagram

  • Out-of-hours support plan

  • Incident management plan

@Finkregh
Finkregh / rc.d
Created August 14, 2012 13:37 — forked from jippi/rc.d
Logstash Init script
update-rc.d logstash-shipper defaults
update-rc.d logstash-reader defaults
@Finkregh
Finkregh / latency.markdown
Created August 22, 2012 11:40 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@Finkregh
Finkregh / sbm.sh
Created September 18, 2012 15:38 — forked from splitbrain/sbm.sh
CLI tool to create an SSH alias
# SSH bookmark creator
sbm(){
if [ $# -lt 2 ]; then
echo "Usage: sbm <short> [<user>@]<hostname> [-p <port>]" >&2
return 1
fi
short=$1
arg=$2
@Finkregh
Finkregh / logstash.conf
Created October 8, 2012 09:37 — forked from reyjrar/logstash.conf
LogStash Configuration
input {
tcp {
type => "syslog"
port => 8514
}
}
filter {
## DISCARD IMPROPERLY FORMATTED MESSAGES
@Finkregh
Finkregh / graphite-deb.sh
Created November 12, 2012 08:36 — forked from rcrowley/graphite-deb.sh
Graphite Debian packaging
VERSION="0.9.9"
BUILD="betable1"
set -e -x
# Keep track of the original working directory.
OLDESTPWD="$PWD"
# Work in a temporary directory.
cd "$(mktemp -d)"
# graphite-web install is hardcoded in setup.cfg to /opt/graphite
sudo mkdir /opt/graphite
sudo chown brad.users /opt/graphite
# run under python2.7 virtualenv
virtualenv --python=python2.7 ~/ve/graphite
source ~/ve/graphite/bin/activate
# install the necessary python packages (simplejson is for flot graphs)
pip install graphite-web carbon whisper django django-tagging uwsgi simplejson