Skip to content

Instantly share code, notes, and snippets.

Dreampuf dreampuf

Block or report user

Report or block dreampuf

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
debrice / Flask-SQLAlchemy
Last active Sep 12, 2019
Flask SQLAlchemy Caching
View Flask-SQLAlchemy

Flask-SQLAlchemy Caching

The following gist is an extract of the article Flask-SQLAlchemy Caching. It allows automated simple cache query and invalidation of cache relations through event among other features.


retrieve one object

# pulling one User object
user = User.query.get(1)
View ssh
package main
import (
klovadis / gist:5170446
Created Mar 15, 2013
Two Lua scripts for Redis to turn HGETALL and HMGET into dictionary tables
View gist:5170446
-- gets all fields from a hash as a dictionary
local hgetall = function (key)
local bulk ='HGETALL', key)
local result = {}
local nextkey
for i, v in ipairs(bulk) do
if i % 2 == 1 then
nextkey = v
result[nextkey] = v
josegonzalez / access.lua
Created Dec 3, 2012
Simple lua file enabling oauth support for nginx via nginx-lua and access_by_lua.
View access.lua
- certain endpoints are always blocked
if nginx_uri == "/_access_token" or nginx_uri == "/_me" then
-- import requirements
local cjson = require "cjson"
-- setup some app-level vars
local app_id = "APP_ID"
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:


start new with session name:

tmux new -s myname
hellerbarde / latency.markdown
Created May 31, 2012 — forked from jboner/latency.txt
Latency numbers every programmer should know
View latency.markdown

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs
Read 1 MB sequentially from memory ..... 250,000 ns  = 250 µs
View tmux_cheatsheet.markdown

tmux cheatsheet

As configured in my dotfiles.

start new:


start new with session name:

schuster-rainer / rx_websocket_protokol.html
Created Feb 20, 2012
WebSocket Demo using ws4py, cherrypy to echo incomming traffic. CoffeeScript, jQuery, RxJS, websock.js for the Client
View rx_websocket_protokol.html
<!DOCTYPE html>
<html lang="de">
<meta charset="utf-8" />
<title>Pushing with Rx and websock.js</title>
<script src="script/jquery-1.7.1.js" type="text/javascript"></script>
<script src="script/rx.min.js" type="text/javascript"></script>
<script src="script/rx.jquery.js" type="text/javascript"></script>
<script src="script/rx.time.min.js" type="text/javascript"></script>
<script src="script/base64.js"></script>
baali /
Created Dec 6, 2011
A Python script to break audio into chunks of smaller audios and using Google API to get Speech to Text.
A hack based on this While with smaller voice samples google speech to text works really good, as length increases quality decreases. So here using audiolab and numPy we are breaking audio sample, in smaller chunks, and removing blank/empty spaces from audio signal and then pushing them to google for processing.
It takes wav file format as input but can be changed to other formats too.
from scikits.audiolab import wavread, play, flacwrite
from numpy import average, array, hstack
import os
import sys
shnjp /
Created Mar 5, 2011
ssh tunnel for Fabric
Fabric tunneling utilities
class ForwardServer and relates things are refere Robey Pointer's paramiko example.
with make_tunnel('user@') as t:
You can’t perform that action at this time.