Skip to content

Instantly share code, notes, and snippets.

View gwillem's full-sized avatar
💫

Willem de Groot gwillem

💫
View GitHub Profile
@gwillem
gwillem / ansible-bootstrap-ubuntu-16.04.yml
Created June 16, 2016 21:59
Get Ansible to work on bare Ubuntu 16.04 without python 2.7
# Add this snippet to the top of your playbook.
# It will install python2 if missing (but checks first so no expensive repeated apt updates)
# gwillem@gmail.com
- hosts: all
gather_facts: False
tasks:
- name: install python 2
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC9WvLLfPGlR3HYDgqbbjvlGA3fiy6e8/YR0vkHyDQXF7u2fTe8USzDLvXMUf4JcQjfZyRw26lNghkzWOSN7EyhlqBm7Njy5rKV3+frx92Sjk3+maAvP4CB8oGjabSsHe4JnDxLQ6LznoVNhNR/YoTm8FUXsbvMDvubJcKB+KM3ViY9mWq6swZ0ILrZSGHyJP3wWRhSo91/ZO0m+CIOOUEgj1E+1tR/TItHIN85PgLP62zUFgwOt6eSo8SUgzqTwkeuG2pb2f6810iw/yfZLl6hPF4JOc26ar6sZy7Rma9W4pFuxPUqMpDfZq2h1Y518Ipv5aFG8BYF5YUr7hKYd7QKV/kuO4Q6YEzEMeFTfFPZGKCfvUVuEd7wsyOahrzpbpWr0620ijSlkkIZNh0qO1PpYSGLePLp5zl5I1hn65DZEHF5Bp3iB4eNmm9zwpSg1hBtjHQWpYn2lmZoXldRLMombBfCN8BYihJSw7r8CZqc5y8wvBIQDMp2xP8OAiqqqlv4gKiF33byAmU0RIKbHNdQ6dfLtkE7ePPLcHJUioEsoUklunqsATtfybHldAYFDuYHl0Z/bClN72jzFIjaU2HEnJZHAj2a5MQsPtqt9qxC+SYd41DZXdFNv5uWKH3qQ3f9zRB3iaXshqwMsMunjPx6kMln4Q42tr3E3d1ThIYw6Q== hypernode-control
@gwillem
gwillem / add-current-spotify-song-to-favorites.py
Last active September 16, 2021 00:48
Ubuntu: add current Spotify song to favorites (playlist)
#!/usr/bin/env python3
"""
gwillem@gmail.com
Read current playing track from D-BUS and add it to my favorites
playlist. Any previous instances of the same track on the playlist are removed.
I have mapped this script to the XF86Favorite key of my Microsoft Natural Keyboard.
@gwillem
gwillem / simple-php-xml-benchmark.md
Last active March 14, 2017 13:54
Simple PHP XML benchmark

In practice this mini benchmark seems to be a good indicator of Magento performance.

# Download ~1MB XML sample file
sudo apt-get install -y php-cli php-xml time
mkdir -p ~/xmltest
cd ~/xmltest
wget http://www.cs.washington.edu/research/xmldatasets/data/mondial/mondial-3.0.xml
cat >test.php <<'EOM'
php
@gwillem
gwillem / install.sh
Created March 23, 2016 15:34
Enable command line pull requests
mkdir -p ~/bin
curl -sL https://github.com/github/hub/releases/download/v2.2.3/hub-linux-amd64-2.2.3.tgz |\
tar --wildcards --strip-components 2 -xzf - \*/bin/hub -C ~/bin
echo <<EOM >> ~/.gitconfig
[alias]
pr = pull-request
EOM
git commit -m "bla"
Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await r_await w_await svctm %util
vda 0.00 0.00 0.00 0.40 0.00 2.40 12.00 1.48 3636.00 0.00 3636.00 2500.00 100.00
@gwillem
gwillem / fake-user-agents.txt
Last active January 26, 2016 14:02
Transip Runaway Crawler
1st ZipCommander (Net) - http://www.zipcommander.com/
Ace Explorer
ActiveBookmark 1.x
Activeworlds
ActiveWorlds/3.xx (xxx)
Advanced Browser (http://www.avantbrowser.com)
Amiga-AWeb/3.4.167SE
AmigaVoyager/3.4.4 (MorphOS/PPC native)
annotate_google; http://ponderer.org/download/annotate_google.user.js
ANTFresco/x.xx
#!/usr/bin/env python3.5
import asyncssh
import asyncio
import sys
"""
Testing for 200 hosts:
5 => 40s
diff --git app/code/core/Mage/Admin/Model/Observer.php app/code/core/Mage/Admin/Model/Observer.php
index 9c04324..9d39424 100644
--- app/code/core/Mage/Admin/Model/Observer.php
+++ app/code/core/Mage/Admin/Model/Observer.php
@@ -34,6 +34,7 @@
class Mage_Admin_Model_Observer
{
const FLAG_NO_LOGIN = 'no-login';
+
/**
@gwillem
gwillem / robots.txt
Created January 5, 2016 12:48
Sample robots.txt for Magento on Hypernode
User-agent: *
Allow: /
Crawl-delay: 25
sitemap: http://magentotestpakket.nl/sitemap.xml
Disallow: /*?p=
Disallow: /*&p=
Disallow: /*?price=
Disallow: /*&price=
Disallow: /*?color=