Skip to content

Instantly share code, notes, and snippets.

View marksilvis's full-sized avatar

Mark Silvis marksilvis

View GitHub Profile
@marksilvis
marksilvis / tornado_multiproc.py
Created October 23, 2017 21:17
Example Tornado server with multiple processes running background tasks
import time
form tornado import (
concurrent,
gen,
httpserver,
ioloop,
log,
process,
web
@marksilvis
marksilvis / tornado_background.py
Created October 23, 2017 21:11
Tornado example with non-blocking background tasks executed in thread pool
import time
from tornado import (
concurrent,
gen,
httpserver,
ioloop,
log,
web
)
@marksilvis
marksilvis / tornado_periodic.py
Last active October 23, 2017 21:07
Tornado server with multiple periodic callbacks and a repeated background task
# python
import logging
import time
from tornado import gen, httpserver, ioloop, log, web
log.enable_pretty_logging()
class MainHandler(web.RequestHandler):
@marksilvis
marksilvis / s3upload.js
Created October 6, 2017 02:01
Node.js upload to AWS S3
// requires AWS SDK
var AWS = require('aws-sdk')
, fs = require('fs');
var s3 = new AWS.S3({
apiVersion: '2006-03-01',
accessKeyId: 'AccessKey',
secretAccessKey: 'SecretKey',
region: 'region'
});
@marksilvis
marksilvis / pip-upgrade-all.sh
Last active May 23, 2017 17:05
Upgrade all pip dependencies
pip3 freeze --local |
grep -v '^\-e' |
cut -d = -f 1 |
xargs -n1 pip3 install -U
@marksilvis
marksilvis / brew-unused.sh
Last active May 5, 2017 01:28
Find unused brew formulas
brew list |
while read cask; do echo -n $cask; brew uses --installed $cask |
awk '{printf(" %s ", $0)}'; echo ""; done