Skip to content

Instantly share code, notes, and snippets.

View joar's full-sized avatar
:bowtie:
Not wearing a bowtie

Joar Wandborg joar

:bowtie:
Not wearing a bowtie
View GitHub Profile
import time
import logging
import os
from collections import namedtuple
import cv2
import numpy as np
from matplotlib import pyplot as plt
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import time
import logging
import os
from collections import namedtuple
import cv2
import numpy as np
from matplotlib import pyplot as plt

trak

Multi-party ticket handling and coordination.

Develop

@joar
joar / socker_auth.py
Created June 11, 2015 09:52
Socker auth pseudocode
import yourapp
AUTH_BACKENDS = [
yourapp.socker_auth
]
def socker_handle_connect(client):
while True:
msg = client.wait_for_message()
@joar
joar / README.md
Last active August 29, 2015 14:23
Print Your Tacos

Usage:

curl -O https://gist.githubusercontent.com/joar/3618b29180ab0ff67ac7/raw/tacofont.py
python tacofont.py taco
🐓🌮🌮🌮🌮🌮🐓🐓🌮🌮🌮🐓🐓🌮🌮🌮🌮🌮🐓🌮🌮🌮🌮🌮🐓
🐓🐓🐓🌮🐓🐓🐓🌮🐓🐓🐓🌮🐓🌮🐓🐓🐓🐓🐓🌮🐓🐓🐓🌮🐓
🐓🐓🐓🌮🐓🐓🐓🌮🌮🌮🌮🌮🐓🌮🐓🐓🐓🐓🐓🌮🐓🐓🐓🌮🐓
🐓🐓🐓🌮🐓🐓🐓🌮🐓🐓🐓🌮🐓🌮🐓🐓🐓🐓🐓🌮🐓🐓🐓🌮🐓
🐓🐓🐓🌮🐓🐓🐓🌮🐓🐓🐓🌮🐓🌮🌮🌮🌮🌮🐓🌮🌮🌮🌮🌮🐓
import sys
from itertools import permutations
print(len(list((lambda n: (lambda cols: (True for vec in permutations(range(n)) if n == len(set(vec[i]+i for i in cols)) == len(set(vec[i]-i for i in cols))))(range(n)))(int(sys.stdin.readline())))))

Wireshark HTTP traffic debugging

Usage

Without traffic source filtering http && http.content_type != "text/css" && http.content_type != "application/javascript" && http.content_type != "image/jpeg" && http.content_type != "image/png" && http.content_type != "image/gif"

With traffic source filtering ( in this case 173.203.203.8 is my remote server ) http && ( ip.src == 173.203.203.8 || ip.dst == 173.203.203.8 ) && http.content_type != "text/css" && http.content_type != "application/javascript" && http.content_type != "image/jpeg" && http.content_type != "image/png" && http.content_type != "image/gif"

Explanation

@joar
joar / collision.js
Last active September 7, 2015 07:37
D3 rectangular collisions
const RIGHT = 0,
DOWN = 1.5707963267948966,
LEFT = Math.PI,
UP = -1.5707963267948966
let DIRECTION_MAP = {}
DIRECTION_MAP[UP] = 'UP'
DIRECTION_MAP[DOWN] = 'DOWN'
DIRECTION_MAP[LEFT] = 'LEFT'
@joar
joar / graph.json
Last active September 9, 2015 09:25 — forked from eyaler/graph.json
Force-Directed Graph with Drag/Zoom/Pan/Center/Resize/Labels/Shapes/Filter/Highlight
{
"graph": [],
"links": [
{"source": 0, "target": 1},
{"source": 0, "target": 2},
{"source": 0, "target": 3},
{"source": 0, "target": 4},
{"source": 0, "target": 5},
{"source": 0, "target": 6},
{"source": 1, "target": 3},