Skip to content

Instantly share code, notes, and snippets.

@ccoenen
ccoenen / .gitconfig
Created May 14, 2014 15:04
Git Configuration (Windows)
[user]
name = My Awesome name
[core]
excludesfile = c:/Users/....../.gitignore_global
editor = 'C:/Program Files (x86)/Notepad++/notepad++.exe' -multiInst -nosession -noPlugin
autocrlf = false
[push]
default = simple
@ccoenen
ccoenen / upnp2mrtg.sh
Last active August 29, 2015 14:06
upnp2mrtg fork
#!/bin/bash
#
# MINOR CHANGES IN THIS VERSION, NOT ACTUALLY THE ORIGINAL RELEASE!
#
# upnp2mrtg - Monitoring AVM Fritz!Box With MRTG
# This versions have been reported as working: 3030, 5050, 7050, 7141 and 7170
#
# Copyright (C) 2005 Michael Tomschitz <michael.tomschitz@ANetzB.de>
#
# This program is free software; you can redistribute it and/or modify
@ccoenen
ccoenen / keybase.md
Created January 23, 2015 20:15
Keybase

Keybase proof

I hereby claim:

  • I am ccoenen on github.
  • I am amenthes (https://keybase.io/amenthes) on keybase.
  • I have a public key whose fingerprint is AC0E EF09 8692 337D C2DF 08AC 1643 AC59 BD9B 1572

To claim this, I am signing this object:

@ccoenen
ccoenen / 0-readme.md
Last active August 29, 2015 14:15
Monty Hall Problem Simulator

The Monty Hall Problem is a probability puzzle.

When i read [this article about Marilyn vos Savant][1], my initial reaction was "that can't be right". I continued to read the comments, the [wikipedia page][2] and then started a table to see if this was indeed the case. Being a programmer, i then started a simulation.

This is what it turned out to be.

The concise explanation is: The door's chance does not change. This

@ccoenen
ccoenen / monitoring.sh
Created March 3, 2015 13:01
Simple Monitoring with statsd, shell and netcat
PREFIX=any.prefix.will.do
STATSD_HOSTNAME=your.server.name
STATSD_PORT=8125
while true; do
echo "$PREFIX.systemload1:`cut -f1 -d " " /proc/loadavg`|g" | ./nc -u -q 0 $STATSD_HOSTNAME $STATSD_PORT
cat /proc/stat | grep "cpu " | \
while read -r cpu user nice system idle iowait irq softirq steal guest guestnice
do
@ccoenen
ccoenen / exploit.js
Created April 26, 2011 19:42
De-Obfuscation of the Facebook-Exploit
// # The Exploit comes as an event-invitation, it wants you to klick this link
// http://www.goo gle.com/url?sa=t&source=web&cd=1&ved=0CBoQFjAA&url=http%3A%2F%2Fwho-spying-u.blogspot.com%2F&ei=SHO2TaA kiNiIAve95Sk&usg=AFQjCNH_JxkE7o8CvUwsLVUwr2eGGP4ecw&sig2=Ye1vqVHrMDHWkRv--npMkw%3 Fqw020fbs (remove spaces if interested)
// # The link is a redirect to ht tp: //ge rman -spy3 .bl ogsp ot.c om/ (remove spaces if interested)
// # you are directed to copy and paste a snipped of JS Code into your address-bar, see loader.js below.
// # This script was taken from iamedwards.com on 2011-04-26
// this file can be downloaded by using curl with a refer and user-agent like this:
// curl -i -e "http://www.facebook.com" -A "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0) Gecko/20100101 Firefox/4.0" http://iamedwards.com/german.php?0.214
// # ran it through a beautifier
// # ran it through a for-loop to de-obfuscate the texts like this: for (var t in _0x8a40) { document.write('"'+_0x8a40[t] + '", '); }
// # started comment
@ccoenen
ccoenen / console.xml
Last active December 15, 2015 23:29
My Console2 Config. Get Console2 at http://sourceforge.net/projects/console/
<?xml version="1.0"?>
<settings>
<!--
Bonus-Tip: set init_dir to the default location, where all your shells should open (can be overriden on a per-shell basis)
-->
<console change_refresh="10" refresh="100" rows="30" columns="110" buffer_rows="2000" buffer_columns="0" shell="" init_dir="MY PROJECT DIRECTORY" start_hidden="0" save_size="0">
<colors>
<color id="0" r="0" g="0" b="0"/>
<color id="1" r="0" g="0" b="128"/>
<color id="2" r="0" g="150" b="0"/>
@ccoenen
ccoenen / searchLogForJSON.rb
Created December 12, 2013 13:26
I had 4GB of logfiles which consisted of mixed line-based content and JSON data. So i combined an evented JSON Parser with a regular linebased search. The logfile was generated by zabbix-server, set to the most verbose loglevel. We used this script to generate a list of all hosts and items that were still sending data to this machine.
require 'yajl'
require 'yajl/json_gem'
@hostlist = {}
def object_parsed(obj)
puts Yajl::Encoder.encode(obj)
obj.each do |item|
if item['request'] == 'sender data'
#!/usr/bin/env ruby
# moves files containing 002 on line 9 to a different directory.
require 'fileutils'
FileUtils.mkdir_p('with002')
FileUtils.mkdir_p('no002')
def contains_zero_zero_two?(filename)
@ccoenen
ccoenen / anchor-test.md
Last active April 2, 2018 09:18
Test of Hackmd Issue #795

Summary Heading

test