Skip to content

Instantly share code, notes, and snippets.

// ==UserScript==
// @name New Script
// @include http://mlp-fim-wallpapers.deviantart.com/
// @exclude http://mlp-fim-wallpapers.deviantart.com/
// ==/UserScript==
console.log('Deviant Art Pony Wallappers!');
galleryPages = document.querySelectorAll('.tv150');
thumbNails = document.querySelectorAll('.thumb');
@thorsummoner
thorsummoner / nettest.py
Created July 6, 2017 21:42
Serve file of size N over facecgi.
#!/usr/bin/python3
import os
import subprocess
import re
import humanfriendly
SIZE_RE = re.compile("^\d{,4}([KMG])$")
def main():
file_size = (
@thorsummoner
thorsummoner / nettest.cgi.py
Created March 16, 2017 18:35
Dispatch zero-fill file of user request size over the network.
#!/usr/bin/python3
import os
import subprocess
import re
import humanfriendly
SIZE_RE = re.compile("^\d{,4}([KMG])$")
def main():
file_size = (
@thorsummoner
thorsummoner / Default (Linux).sunblime-keymap
Last active March 16, 2017 16:25
Sublime text 3 Linux keymap to be more like my bloody Windows keymap.
[
{ "keys": ["ctrl+q"], "command": "toggle_comment", "args": { "block": false } },
{ "keys": ["ctrl+shift+q"], "command": "toggle_comment", "args": { "block": true } },
{ "keys": ["ctrl+shift+w"], "command": "close" },
{ "keys": ["ctrl+space"], "command": "auto_complete" },
{ "keys": ["ctrl+space"], "command": "replace_completion_with_auto_complete", "context":
[
{ "key": "last_command", "operator": "equal", "operand": "insert_best_completion" },
{ "key": "auto_complete_visible", "operator": "equal", "operand": false },
{ "key": "setting.tab_completion", "operator": "equal", "operand": true }
my_hello = 'Hello!'
my_world = {
'antartica': 'cold',
}
anonymous_callback = function (injected1, injected2, param1, param2) {
param1 = param1 ? param1 : 'One';
param2 = param2 ? param2 : 'Two';
#!/usr/bin/env python3
""" Example argparser based python file
"""
import argparse
ARGP = argparse.ArgumentParser(
description=__doc__,
formatter_class=argparse.RawTextHelpFormatter,
@thorsummoner
thorsummoner / userlogs
Created January 18, 2017 20:20
logrotate user logs
# /etc/logrotate.d/userlogs
/var/run/user/*/log/*.log
/var/run/user/*/log/**/*.log
{
daily
missingok
rotate 7
compress
notifempty
@thorsummoner
thorsummoner / pythonic.md
Created October 21, 2016 22:22
How to be pythonic

To answer "getting a better understanding of python", I feel strongly that

#!/bin/sh
true | openssl s_client -connect outlook.com:443 | openssl x509 -noout -text | grep -B1 DNS:
@thorsummoner
thorsummoner / logging.py
Last active September 29, 2016 17:14
logging snippet
#!/usr/bin/env python3
import logging
logging.basicConfig(level=logging.INFO)
logging.getLogger('urllib3').setLevel(logging.WARNING)
LOGGER = logging.getLogger(os.path.basename(__file__))