Skip to content

Instantly share code, notes, and snippets.

View kragniz's full-sized avatar
🥀
🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓

Louis Taylor kragniz

🥀
🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓🥀⛓
View GitHub Profile
@kragniz
kragniz / 2.py
Created August 3, 2012 21:51
A2S 2
#!/usr/bin/env python
import itertools
def f(a, b, c, d):
return a*b + b*c + c*d + a*d
greatest = 0
for p in itertools.permutations([1,2,3,4]):
c = f(*p)
if c > greatest:
s='1120111011101120711011201110211011303120511011201110211011102150311011201110115021101110311011303120713021101130313011201150311011202150111031301120212021203110112011106110111011102110113011202110111011101120113011201110111011202120111021402110113021202120211051703130112011301140113031606120211031101110211041401110112041203110112011103110212021101130311011202110111021303120312031202130211011201110111021304130211021103110413041201120111041201110711021103110415011402120511011103110311011301130212041101110411011102120114041203140112021201110211011303130111011101150111031'
l='0'+str(int(''.join([int(s[2*i])*s[2*i+1] for i in range(len(s)/2)]),base=2))
print ''.join(map(lambda x:chr(int(x)),[(l)[i:i+3] for i in range(0,len(l),3)]))
@kragniz
kragniz / hue.py
Last active December 20, 2015 09:39
Some basic image segmentation based on hue.
import cv2
import time
import numpy as np
import json
import os
#uncomment this for testing from an image file
#img = cv2.imread(filename)
capture = cv2.VideoCapture(1)
@kragniz
kragniz / dota.py
Last active December 20, 2015 21:39
Small match history module.
#!/usr/bin/env python
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) any later version.
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
{
"main": [
{"x": 50},
"print", ["hello there, x is", "x"]
]
}
-----BEGIN PGP MESSAGE-----
Version: GnuPG v1.4.15 (GNU/Linux)
hQEMA2qyZ5GHDXmKAQf/WUFQrW1AkN0tdOeRQykWWLuhv/eyhytTfJ1dPifitmbN
V2cvpEEjCOqq8RMtb+YhOX6OHZ7xypEHoLMUpYyWtXk1DDGQOCpY1jQdhfDQnzKs
8cxaZh/btDFSOE5ybHHSzKK+0dRDu4PhuNrIO8Gw+0KHtRp+7bd/zlRQaRYoQe9u
fy2m3IqD0dNgCUsne7cRbUU4QOC2MuJvsqYyhRyLLcRCB5aoyZVqbQExFYXqJeGh
AQ5bCSqxjAJtQiwFGAdJPNBkQn0f9BMsmBzTfXM/ExPM5fsdcvIq35dXeY/WVFpO
0oOd/UTaGVoSlvolNh4eT/vTvgZUy1ctan4M5oatxdKYAWA2OUeNmyIHHYqEjT1f
D7wdvkQi0iQB9SKnvjoH7+KZWW8i+4Gr7oPJiaLUHENjmorYt4mynFijcA2hWIXM
@kragniz
kragniz / micropython-logo.svg
Created January 4, 2014 20:01
Micopython logo
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kragniz
kragniz / extract
Last active January 2, 2016 12:59
Extract urls from debian error messages
#!/usr/bin/env python
import re, sys
for l in sys.stderr.readlines():
url = re.findall(r'http:.+\.deb', l)
if len(url):
print url[0]
@kragniz
kragniz / Bridge.py
Last active January 4, 2016 07:59 — forked from hmurraydavis/Bridge.py
#! /usr/bin/python
"""Copyright 2011 Phidgets Inc.
This work is licensed under the Creative Commons Attribution 2.5 Canada License.
To view a copy of this license, visit http://creativecommons.org/licenses/by/2.5/ca/
"""
__author__="Adam Stelmack"
__version__="2.1.8"
__date__ ="14-Jan-2011 2:29:14 PM"