Skip to content

Instantly share code, notes, and snippets.

View stevepeak's full-sized avatar

Steve Peak stevepeak

View GitHub Profile
@stevepeak
stevepeak / tornado-long-polling.py
Last active February 16, 2022 07:15
Tornado Long-Polling Example
from time import sleep
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from tornado.web import Application, asynchronous, RequestHandler
from multiprocessing.pool import ThreadPool
_workers = ThreadPool(10)
def run_background(func, callback, args=(), kwds={}):
def _callback(result):
@stevepeak
stevepeak / tornado.gen.engine.py
Created January 29, 2013 21:36
tornado.gen.engine example
import tornado.ioloop
import tornado.web
import tornado.gen
import tornado.httpclient
class GenAsyncHandler(tornado.web.RequestHandler):
@tornado.web.asynchronous
@tornado.gen.engine
def get(self):
@stevepeak
stevepeak / bootfly.js
Last active December 15, 2015 04:09
Generate Hogan templates on Bootstrap on the fly.
$(document).on('click', '[data-toggle][data-template]', function(){
var target = $($(this).attr('data-target') || $(this).attr('href'));
if( !$(target).data('hogan-template') ){
$(target).data('hogan-template',Hogan.compile(target.html()));}
target.html($(target).data('hogan-template').render($.parseJSON($(this).attr('data-template'))));
});
@stevepeak
stevepeak / callerid-broadcast.py
Last active December 16, 2015 18:50
Fakes caller id broadcasts
# Fake caller id broadcast
MYPORT = 3520
import sys, time, random, datetime
from socket import *
s = socket(AF_INET, SOCK_DGRAM)
s.bind(('', 0))
s.setsockopt(SOL_SOCKET, SO_BROADCAST, 1)
@stevepeak
stevepeak / .gitignore
Last active December 17, 2015 00:28
Create and mange a pip project
*.pyc
.DS_Store
# Packages
*.egg
*.egg-info
dist
build
eggs
parts
@stevepeak
stevepeak / laws.md
Last active December 20, 2015 00:19
Your Time is not My Time - An epic journey through time and a mans quest to understand his place in it.

Your Time is not My Time

An epic journey through time and a mans quest to understand his place in it.

Chapter 1 - The Laws of Time

  • timezone does not effect unix_timestamps
SET time_zone='-05:00';
SELECT unix_timestamp();` # this
SET time_zone='-06:00';
@stevepeak
stevepeak / user.sublime-settings
Last active August 29, 2015 14:00
sublime user settings
{
"bold_folder_labels": true,
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
"font_size": 10.0,
"ignored_packages":
[
"Vintage",
"RestructuredText"
],
"shift_tab_unindent": true,
@stevepeak
stevepeak / guide.md
Last active October 25, 2018 03:26
How to use Github Issue

Milestone Policy

Name must start with a expected version tag ex: v1.4.6. An optional small description is allowed ex: v1.4.6 Custom Title the only these characters are allowed in the title [A-Za-z\d\s\-\:]

Open Milestone

  • tagged version is not deployed to customer
  • pre-release may be available

Open and Complete

  • available in Pre Release for further testing
before_install:
- sudo pip install codecov
after_success:
- codecov
@stevepeak
stevepeak / .travis.yml
Last active August 29, 2015 14:19
Submit reports to Codecov
after_success:
- bash <(curl -s https://codecov.io/bash)