Skip to content

Instantly share code, notes, and snippets.

@knzm
knzm / main.go
Last active August 2, 2018 16:01 — forked from podhmo/main.go
package main
import (
"fmt"
"sort"
)
func formatIntPtr(fmtstr, nilstr string, p *int) string {
if p == nil {
return nilstr
@knzm
knzm / flask_debug.py
Last active October 10, 2015 11:13 — forked from kumagi/flask_debug.py
#!/usr/bin/env python
from __future__ import print_function
from flask import Flask, render_template, Response
import socket
from contextlib import closing
from threading import Thread
from time import sleep
import logging
logger = None
class A(object):
fmt = "tweets %s"
def hello(self):
return "hello " + self.name
@classmethod
def tweets(cls, mes):
return cls.fmt % mes
def __init__(self, name):
self.name = name
@knzm
knzm / sample.py
Created February 21, 2012 15:26 — forked from podhmo/sample.py
# -*- coding:utf-8 -*-
from mako.template import Template
from mako.lookup import TemplateLookup
def generate_source_mako():
with open("source.mako", "w") as w:
w.write("""
<div id="header">
<%block name="header">