Skip to content

Instantly share code, notes, and snippets.

@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 13, 2025 13:48
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@turtlesoupy
turtlesoupy / pg_pool.coffee
Created June 10, 2012 23:34
node-postgres pooled function decorator
pg = require 'pg'
module.exports = pooler =
#Get a connection from the pool
acquire: (callback) -> pg.connect "tcp://postgres:postgres@localhost/dummy_db", callback
#Decorate a function to use the de-pooled connection as a first argument
pooled: (fn) -> ->
callerCallback = arguments[arguments.length - 1]
callerHasCallback = typeof callerCallback == 'function'
@dupuy
dupuy / README.rst
Last active March 31, 2025 05:11
Common markup for Markdown and reStructuredText

Markdown and reStructuredText

GitHub supports several lightweight markup languages for documentation; the most popular ones (generally, not just at GitHub) are Markdown and reStructuredText. Markdown is sometimes considered easier to use, and is often preferred when the purpose is simply to generate HTML. On the other hand, reStructuredText is more extensible and powerful, with native support (not just embedded HTML) for tables, as well as things like automatic generation of tables of contents.

@jclulow
jclulow / awk.js
Created November 10, 2011 05:18
Awk in Javascript?
/*
* map predicate to code...
* /regex/ --> function (groups, next)
* ^ ^ function to call if we should
* | \---skip remaining predicates for this line
* \- e.g. groups[1] is first regex group, etc
*/
function line(predicate, codeblock) {
return ({ predicate: predicate, codeblock: codeblock });
@temoto
temoto / datetime.py
Created March 9, 2011 13:15
Python datetime timezone utils.
# coding: utf-8
from __future__ import absolute_import
"""Datetime utils.
To store time use `naive_to_utc(dt, tz_name)`.
To display time use `utc_to_local(dt, tz_name)`.
"""
import datetime as stdlib_datetime
import pytz
@arikfr
arikfr / .monitrc
Created December 13, 2010 14:35
Setting Monit to work with Gmail as mail server
set mailserver smtp.gmail.com port 587 username "[email protected]" password "password" using tlsv1 with timeout 30 seconds