Skip to content

Instantly share code, notes, and snippets.

View pigletfly's full-sized avatar
🎯
Focusing

Bing Wang pigletfly

🎯
Focusing
  • Hangzhou
  • 06:20 (UTC +08:00)
View GitHub Profile
@pigletfly
pigletfly / main.go
Created January 8, 2018 01:36 — forked from enricofoltran/main.go
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"

Effective Engineer - Notes

What's an Effective Engineer?

  • They are the people who get things done. Effective Engineers produce results.

Adopt the Right Mindsets

@pigletfly
pigletfly / README.md
Created July 5, 2017 10:31 — forked from lbolla/README.md
Asynchronous programming in Tornado

Asynchronous programming with Tornado

Asynchronous programming can be tricky for beginners, therefore I think it's useful to iron some basic concepts to avoid common pitfalls.

For an explanation about generic asynchronous programming, I recommend you one of the [many][2] [resources][3] [online][4].

I will focus on solely on asynchronous programming in [Tornado][1]. From Tornado's homepage:

@pigletfly
pigletfly / bar
Last active December 5, 2016 08:59
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello bar!"
if __name__ == "__main__":
app.run(host='0.0.0.0',port=8000)
@pigletfly
pigletfly / foo
Last active December 5, 2016 09:01
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello foo!"
if __name__ == "__main__":
app.run(host='0.0.0.0')
@pigletfly
pigletfly / .ackrc
Created August 3, 2016 16:08
.ackrc for ack2
--type-set=coffee=.coffee
--type-set=haml=.haml
--type-set=sass=.sass
--type-set=minifiedjs=.min.js
--nocss
--nominifiedjs
--ignore-dir=coverage
--ignore-dir=dragonfly
--ignore-dir=javascripts/lib

Performance of Flask, Tornado, GEvent, and their combinations

Wensheng Wang, 10/1/11

Source: http://blog.wensheng.org/2011/10/performance-of-flask-tornado-gevent-and.html

When choosing a web framework, I pretty much have eyes set on Tornado. But I heard good things about Flask and Gevent. So I tested the performance of each and combinations of the three. I chose something just a little more advanced than a "Hello World" program to write - one that use templates. Here are the codes:

1, Pure Flask (pure_flask.py)

@pigletfly
pigletfly / mysqlcheck.md
Created December 16, 2015 10:34 — forked from francois-blanchard/mysqlcheck.md
Check and Repair MySQL Tables Using Mysqlcheck

Check and Repair MySQL Tables Using Mysqlcheck

Check a Specific Table in a Database

$ mysqlcheck -c database_name table_name -u root -p

Check All Tables in a Database

# Copyright (c) 2010, Philip Plante of EndlessPaths.com
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2012 Ethan Zhang<http://github.com/Ethan-Zhang>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0