Skip to content

Instantly share code, notes, and snippets.

View vane's full-sized avatar
🏴‍☠️
Arrr

Michal Szczepanski vane

🏴‍☠️
Arrr
View GitHub Profile
@vane
vane / osm_geoalchemy_pil.py
Last active December 26, 2015 04:24
create map of warsaw using open street maps, planet_osm_line geoalchemy2 and PIL
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Michal Szczepanski'
import json
import random
from PIL import Image, ImageDraw
from geoalchemy2 import Geometry, func
from sqlalchemy import create_engine, Column
from sqlalchemy.orm import sessionmaker, scoped_session
@vane
vane / imap_backup.py
Last active November 9, 2016 23:10
concurrent email imap backup single python class
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
import os.path
import email
import imaplib
@vane
vane / video_record.html
Created May 6, 2017 18:57
local video clip recorder
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<div>
<video id="preview" width="640" height="480" muted="muted"></video>
<div id="buttons">
@vane
vane / draw_world.py
Created May 7, 2017 18:42
draw-world-python-geojson-matplotlib
#!/usr/bin/python
# -*- coding: utf-8 -*-
from matplotlib import pyplot as plt
from descartes import PolygonPatch
import simplejson
import os
#https://github.com/mledoze/countries/data
BASE_PATH = "your path to data folder"
@vane
vane / audio.py
Last active October 6, 2017 00:51
Some utility functions for audio processing
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
BSD 3-Clause License
Copyright (c) 2017, Michal Szczepanski
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@vane
vane / txredns.py
Created October 10, 2017 23:18 — forked from gleicon/txredns.py
Python/Twisted/Redis backed DNS server.
# Python/Twisted/Redis backed DNS server - resolves from NAME to IP addrs
# fallback to google or any other DNS server to resolv domains not present on Redis
# to set a new domain on redis, just issue a SET domain.tld ip_addr
# run with twistd -ny txredns.tac
# gleicon 2011
from twisted.names import dns, server, client, cache
from twisted.application import service, internet
from twisted.internet import defer
from twisted.python import log
@vane
vane / redis_monitor.py
Last active November 11, 2017 00:57
python redis_monitor.py 127.0.0.1 6379
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import socket
import threading
from collections import Counter
HOST = "127.0.0.1"
PORT = 6379
INTERVAL = 5
@vane
vane / init_rootfs.sh
Last active January 2, 2018 01:30 — forked from jeremyckahn/init_rootfs.sh
Setting up Raspbian rootfs on Ubuntu
#!/bin/bash
# For Ubuntu. Probably works elsewhere too.
# This script downloads the Raspbian file system into ~/rpi/chroot-raspbian-armhf
# It also chroots you into the directory, so you can act as a Raspbian user.
# This was all taken from here: http://superpiadventures.com/2012/07/development-environment/
mkdir -p ~/rpi
cd ~/rpi
@vane
vane / b.py
Created March 3, 2018 08:21
tornado not closing socket
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import bottle
import traceback
import tornado
import tornado.wsgi
import tornado.web
import tornado.ioloop
import concurrent.futures.thread
@vane
vane / t.py
Last active March 3, 2018 09:32
tornado scale wsgi app
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import io
import sys
import bottle
import traceback
import tornado
import tornado.gen
import tornado.log