Skip to content

Instantly share code, notes, and snippets.

@ccoenen
ccoenen / serve.py
Last active December 16, 2022 04:11 — forked from dustingetz/serve.py
#!/usr/bin/env python
import http.server
class MyHTTPRequestHandler(http.server.SimpleHTTPRequestHandler):
def end_headers(self):
self.send_my_headers()
http.server.SimpleHTTPRequestHandler.end_headers(self)
def send_my_headers(self):
self.send_header("Cache-Control", "no-cache, no-store, must-revalidate")
@ccoenen
ccoenen / Deutsche Webhosting Anbieter.md
Last active November 5, 2020 15:47
Nach dem Verkauf von HostEurope an GoDaddy bin ich auf der Suche nach einem deutschen Webhoster für ein kleines privates Paket.
@ccoenen
ccoenen / node-scrypt-to-scrypt-async.js
Last active September 16, 2018 17:39
I am trying to read "old" node-scrypt hashes with scrypt-async. So far with little success. This script needs `scrypt` and `scrypt-async` installed via `npm`
/* ATTEMPT TO PARSE A node-scrypt STRING CORRECTLY FOR USE WITH scrypt-async */
var scrypt = require('scrypt-async');
var scryptOld = require('scrypt');
var crypto = require('crypto');
// Format as seen in node-scrypt, written by Barry Steyn. Scrypt by Colin Percival.
// https://github.com/barrysteyn/node-scrypt/blob/master/scrypt/scrypt-1.2.0/keyderivation.c#L60-L77 and
// https://security.stackexchange.com/a/91050/50616
// scrypt paper: https://www.tarsnap.com/scrypt/scrypt.pdf (not helpful for this :-( )
@ccoenen
ccoenen / anchor-test.md
Last active April 2, 2018 09:18
Test of Hackmd Issue #795

Summary Heading

test

#!/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 / 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'
@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 / 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 / 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 / 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