Skip to content

Instantly share code, notes, and snippets.

@bnadland
bnadland / ssl-sse.py
Created February 5, 2016 21:08
Short example of Flask TLS and SSE
"""
Python 3.4.4
Flask==0.10.1
Jinja2==2.8
MarkupSafe==0.23
Werkzeug==0.11.3
cffi==1.5.0
cryptography==1.2.2
idna==2.0
import (
log "github.com/sirupsen/logrus"
"github.com/jinzhu/gorm"
)
type GormLogger struct {}
func (*GormLogger) Print(v ...interface{}) {
if v[0] == "sql" {
log.WithFields(log.Fields{"module": "gorm", "type": "sql"}).Print(v[3])
@bnadland
bnadland / pystada.py
Created May 10, 2014 00:56
willie-pystada module
from re import search
from willie import module
@module.rule(r".*")
def datefoo(bot, trigger):
if trigger.nick == "github":
m = search(r".*(\d{2}. \S+ \d+)", trigger)
if m:
topic = "Mi, {} um 19:30 || https://pystada.github.io".format(m.group(1))
var page = require('webpage').create();
page.open('http://phantomjs.org', function(status) {
page.includeJs("http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js", function() {
console.log(page.evaluate(function() {
return $('a')
.map(function() {
return this.href;})
.get()
.join();