This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| perl -pi -e 's/"\{\{\s*STATIC_URL\s*\}\}\/?([^"]+)"/"{% static \x27$1\x27 %}"/g' templates/***/*.html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| LIGHT_ID = 123 | |
| LIGHT_LEVEL = 40 | |
| DOMOTICZ_URL = 'http://domoticz/json.htm?' | |
| def fetch(**kwargs): | |
| import json | |
| import urllib | |
| params = urllib.urlencode(kwargs.items()) | |
| url = DOMOTICZ_URL + params |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Quicksort using the Y Combinator (lambda calculus) in pure Python | |
| >>> Y = lambda f: lambda *args: f(Y(f))(*args) | |
| >>> quicksort = Y(lambda f: | |
| ... lambda x: ( | |
| ... f([item for item in x if item < x[0]]) | |
| ... + [y for y in x if x[0] == y] | |
| ... + f([item for item in x if item > x[0]]) | |
| ... ) if x else []) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Computer Futures Worksheet Filler | |
| // @namespace http://wol.ph/ | |
| // @version 1.1 | |
| // @description | |
| // @match https://worksheets.computerfutures.com/index.php?dir=timesheet* | |
| // @match http://worksheets.computerfutures.com/index.php?dir=timesheet* | |
| // @copyright 2015, Wolph | |
| // @run-at document-end | |
| // ==/UserScript== |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Text; | |
| using System.IO; | |
| using System.IO.MemoryMappedFiles; | |
| using System.Threading.Tasks; | |
| using System.Net.Sockets; | |
| using System.Threading; | |
| using System.Runtime.InteropServices; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Assign to me (Bugzilla) | |
| // @namespace http://wol.ph/ | |
| // @version 1.0 | |
| // @description | |
| // @match http://bugzilla.3xo.eu/show_bug.cgi?id=* | |
| // @copyright 2015, Wolph | |
| // ==/UserScript== | |
| var assigned_to_field = document.getElementsByName('assigned_to')[0]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Play in external player | |
| // @namespace http://wol.ph/ | |
| // @version 1.0 | |
| // @grant GM_getValue | |
| // @grant GM_openInTab | |
| // @grant GM_registerMenuCommand | |
| // @grant GM_setValue | |
| // @include http://* | |
| // @include https://* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import re | |
| sticks = { | |
| 0: 6, | |
| 1: 2, | |
| 2: 5, | |
| 3: 5, | |
| 4: 4, | |
| 5: 5, | |
| 6: 6, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash -e | |
| HOST=$(echo "$1" | sed -E -e 's/https?:\/\///' -e 's/\/.*//') | |
| if [[ "$HOST" =~ .*\..* ]]; then | |
| echo "Adding certificate for $HOST" | |
| echo -n | openssl s_client -connect $HOST:443 -servername $HOST \ | |
| | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' \ | |
| | tee "/tmp/$HOST.cert" | |
| sudo security add-trusted-cert -d -r trustRoot \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| exec <"$0" || exit; read v; read v; exec /usr/bin/osascript - "$@"; exit | |
| -- the above is some shell trickery that lets us write the rest of | |
| -- the file in plain applescript | |
| -- Usage: | |
| -- For a simple reload and nothing else: | |
| -- # sh reload_chrome.sh | |
| -- For a reload with activating a different app after (iTerm in this case): | |
| -- # sh reload_chrome.sh iTerm |