Skip to content

Instantly share code, notes, and snippets.

View Fizzadar's full-sized avatar

Nick Mills-Barrett Fizzadar

View GitHub Profile
@Fizzadar
Fizzadar / mypage.html
Created July 15, 2014 11:30
Alternative to flask-webassets w/ autogenerated outfiles via simple jinja2 global
This is a page.
/* Some JS assets */
{{ assets(
'js/test.js', 'js/device.js',
filters='jsmin', extension='js') }}
/* Some CSS assets */
{{ assets(
'css/blah.css', 'css/print.css',
window.readable =function(loops) {
function isDescendant(parent, child) {
var node = child.parentNode;
while (node != null) {
if (node == parent) {
return true;
}
node = node.parentNode;
}
return false;
@Fizzadar
Fizzadar / mod_daemon.php
Last active October 3, 2015 18:28
PHP Daemon Class
<?php
/*
file: app/lib/daemon.php
desc: daemon class
*/
class mod_daemon {
private $jobs = array();
private $threads = array();
private $dbfunc;
@Fizzadar
Fizzadar / collect.py
Created July 27, 2015 07:55
Querying 50k Gameservers in 100 lines of Python
from gevent import monkey
monkey.patch_all()
import logging
from collections import deque
from gevent.pool import Pool
from valve.source.master_server import MasterServerQuerier
from valve.source.a2s import ServerQuerier, NoResponseError
from valve.source.messages import BrokenMessageError
@Fizzadar
Fizzadar / pyclean.sh
Last active January 9, 2016 21:08
Recursively removes pyc files with no matching py file in the current directory
#!/bin/sh
# PyClean
# Remove .pyc files with no matching py file
FILES=`find . -name "*.pyc"`
for PYC_FILE in $FILES; do
PY_FILE=${PYC_FILE/.pyc/.py}
if [ ! -f "$PY_FILE" ] || [ "$1" = "--all" ]; then
@Fizzadar
Fizzadar / table_to_file.lua
Last active January 20, 2016 13:53
Lua table => Lua Code
local testconf = {
test = 'hi',
test2 = {
hi = 'ho',
what = true,
fuck = function() return 'hello' end
}
}
@Fizzadar
Fizzadar / install.sh
Last active February 1, 2016 17:40
uWSGI install on OSX
# Sick of OSX bullshit
# `brew link openssl --force` first
LDFLAGS="-L/usr/local/opt/openssl/lib" LIBRARY_PATH=/usr/local/lib pip install uwsgi -v
import logging
from socket import gaierror, error as socket_error
from paramiko import (
SSHClient, MissingHostKeyPolicy, SSHException, AuthenticationException
)
from inventory import ALL
@Fizzadar
Fizzadar / gist:486d2b4df43816c3ba78
Last active February 7, 2016 15:48
why_openbsd_tops_linux
$ pyinfra -i inventories/dev.py --run server.user 'git --version' -v
...
--> Starting operation: Server/Shell
openbsd56.pyinfra: >>> sh -c 'git --version'
centos6.pyinfra: >>> sh -c 'git --version'
debian8.pyinfra: >>> sh -c 'git --version'
ubuntu14.pyinfra: >>> sh -c 'git --version'
debian7.pyinfra: >>> sh -c 'git --version'
ubuntu15.pyinfra: >>> sh -c 'git --version'
centos7.pyinfra: >>> sh -c 'git --version'
@Fizzadar
Fizzadar / install.txt
Last active March 7, 2016 13:30
Setting up usable IPMI on OSX via SSH tunnel
+ Get Virtualbox
+ Get Windows trial Virtualbox image
+ Boot Winblows, install Java 1.6 (good luck, signup for Oracle and all)
+ SSH forward on host OSX
+ Get ProxyCap in Windows
+ Set ProxyCap to proxy *everything* via 10.0.2.2:SSHFORWARDPORT