Skip to content

Instantly share code, notes, and snippets.

@vierbergenlars
vierbergenlars / segv.php
Created November 20, 2012 16:49
Get a PHP segfault

First, clone git clone git@github.com:vierbergenlars/gihp.git Check out git checkout 08dc6abfdbf90b1e1a8b10cd7064601fb820d950 And then insert the file above and run with php segv.php

@vierbergenlars
vierbergenlars / build.sh
Last active December 12, 2015 03:28
UglifyJS bug report attachment
uglifyjs original.js -c -b --comments all -o commented.js
uglifyjs original.js -c -m -o min.js
def and(bits1, bits2):
"""
Executes AND operation on 2 binary numbers, like it is done internally when using & operator
"""
bits_out = []
while True:
if i > len(bits1) && i > len(bits2):
# We have past all bits in both numbers, break out of the loop now
break
if i < len(bits1):
@vierbergenlars
vierbergenlars / bogosort.py
Created March 12, 2013 11:18
Fastest sorting algorithm ever! Introducing BogoSort
#!/usr/bin/env python
"""
http://acm.zhihua-lai.com
BogoSort.py
Bogo Sorting Algorithm
30/May/2012
https://raw.github.com/DoctorLai/Algorithms/master/Sorting/BogoSort.py
"""
from random import *
@vierbergenlars
vierbergenlars / gist:5191906
Last active January 3, 2017 13:14
Recursively fix the PHP coding style on all commits in a repository
# Run these commands and the repo will be back in sync
# Note: tags are lost, because the commits are rewritten
sudo curl http://cs.sensiolabs.org/get/php-cs-fixer.phar -o /usr/local/bin/php-cs-fixer
sudo chmod a+x /usr/local/bin/php-cs-fixer
git filter-branch --tree-filter "php-cs-fixer fix .>/dev/null" --all
@vierbergenlars
vierbergenlars / 0-litus-installer.md
Last active March 6, 2021 14:19
Litus installation
#deb cdrom:[Ubuntu-GNOME 13.04 _Raring Ringtail_ - Release amd64 (20130424)]/ raring main multiverse restricted universe
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://be.archive.ubuntu.com/ubuntu/ raring main restricted
deb-src http://be.archive.ubuntu.com/ubuntu/ raring main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://be.archive.ubuntu.com/ubuntu/ raring-updates main restricted
@vierbergenlars
vierbergenlars / install.sh
Last active December 16, 2015 18:59
Kotnet login script. Just run sudo ./install.sh
apt-get install -y perl libwww-mechanize-perl
mv kotnet_login.pl /etc/NetworkManager/dispatcher.d/02kotnet
ln -s /etc/NetworkManager/dispatcher.d/02kotnet /etc/init.d/kotnet
update-rc.d kotnet defaults
def count(lst, elem):
if len(lst) == 1:
return lst[0] == elem
else:
return count(lst[1:], elem) + (lst[0] == elem)
@vierbergenlars
vierbergenlars / .conkyrc
Last active December 18, 2015 00:08
Installation instructions: Install fonts (move to /usr/share/fonts/); Move files as indicated
# About this gist: http://vierbergenlars.wordpress.com/2013/06/07/tweaking-ubuntu-gnome-with-conky/
# Conky settings #
background no
update_interval 1
cpu_avg_samples 2
net_avg_samples 2
if_up_strictness address