Skip to content

Instantly share code, notes, and snippets.

@rduplain
rduplain / README.rst
Created February 13, 2011 05:21
Demonstrate use of fixture with Flask-SQLAlchemy and Flask-Testing.

Demonstrate use of fixture with Flask-SQLAlchemy and Flask-Testing. February 13, 2011 Ron DuPlain <ron.duplain@gmail.com>

Post any feedback to: flask@librelist.org

Get this gist:

git clone git://gist.github.com/824472.git Flask-SQLAlchemy-Fixture
cd Flask-SQLAlchemy-Fixture
@spicycode
spicycode / tmux.conf
Created September 20, 2011 16:43
The best and greatest tmux.conf ever
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000
@jboner
jboner / latency.txt
Last active June 8, 2024 14:56
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active June 8, 2024 17:28
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@markyun
markyun / gist:6061416
Last active April 13, 2024 05:57
国内各大互联网公司相关技术站点2.0版 (集合腾讯、阿里、百度、搜狐、新浪、360等共49个)
国内各大互联网公司相关技术站点2.0版 (集合腾讯、阿里、百度、搜狐、新浪、360等共49个)
利用闲暇时间整理了一份国内各大互联网公司的相关技术站点,希望能够对大家有所帮助,也欢迎各位帮忙补充。
腾讯系列(13) 阿里系列(18) 百度系列(3) 搜狐系列(3) 新浪系列(2) 360系列(2) 其他(9)
腾讯系列(13)
@v5tech
v5tech / linux-http-tcp.md
Last active February 3, 2023 07:13
linux下查看http 并发和 tcp连接数

linux查看httpd进程数

ps -ef | grep httpd | wc -l

查看Apache的并发请求数及其TCP连接状态

netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'
@Kartones
Kartones / postgres-cheatsheet.md
Last active June 7, 2024 13:13
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@ryerh
ryerh / tmux-cheatsheet.markdown
Last active June 8, 2024 16:30 — forked from MohamedAlaa/tmux-cheatsheet.markdown
Tmux 快捷键 & 速查表 & 简明教程

注意:本文内容适用于 Tmux 2.3 及以上的版本,但是绝大部分的特性低版本也都适用,鼠标支持、VI 模式、插件管理在低版本可能会与本文不兼容。

Tmux 快捷键 & 速查表 & 简明教程

启动新会话:

tmux [new -s 会话名 -n 窗口名]

恢复会话:

@robbie-cao
robbie-cao / libuv-vs-libev.md
Created January 3, 2017 12:12
libuv vs libev

libuv 和 libev ,两个名字相当相近的 I/O Library,最近有幸用两个 Library 都写了一些东西,下面就来说一说我本人对两者共同与不同点的主观表述。

高性能网络编程这个话题已经被讨论烂了。异步,异步,还是异步。不管是 epoll 也好,kqueue 也罢,总是免不了异步这个话题。

libuv是异步的,libev是同步的多路IO复用。

libev 是系统I/O复用的简单封装,基本上来说,它解决了 epoll ,kqueuq 与 select 之间 API 不同的问题。保证使用 livev 的 API 编写出的程序可以在大多数 *nix 平台上运行。但是 libev 的缺点也是显而易见,由于基本只是封装了 Event Library,用起来有诸多不便。比如 accept(3) 连接以后需要手动 setnonblocking。从 socket 读写时需要检测 EAGAIN 、EWOULDBLOCK 和 EINTER 。这也是大多数人认为异步程序难写的根本原因。

libuv 则显得更为高层。libuv 是 joyent 给 Node 做的一套 I/O Library 。而这也导致了 libuv 最大的特点就是处处回调。基本上只要有可能阻塞的地方,libuv 都使用回调处理。这样做实际上大大减轻了程序员的工作量。因为当回调被 call 的时候,libuv 保证你有事可做,这样 EAGAIN 和 EWOULDBLOCK 之类的 handle 就不是程序员的工作了,libuv 会默默的帮你搞定。

@fno2010
fno2010 / wacom-mac-remover.sh
Created December 14, 2018 19:31
Clear all the installed files by Wacom Driver
#/bin/bash
# Clear all the installed files by Wacom Driver
rm -rf /Applications/Wacom\ Tablet.localized
rm -rf /Applications/Pen\ Tablet.localized
rm -rf /Library/Application\ Support/Tablet
rm -rf /Library/Extensions/Wacom\ Tablet.kext