Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Use mycli (http://mycli.net/) through ssh
Usage:
$ mycli-ssh yourhost [extra args passed to mycli]
"""
@oanhnn
oanhnn / using-multiple-github-accounts-with-ssh-keys.md
Last active May 7, 2024 12:29
Using multiple github accounts with ssh keys

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@mbirtwell
mbirtwell / gist:aaccdb7972e1a7ed094b
Last active December 21, 2017 17:53
SQLAlchemy Enum recipe enhanced for use in postgresql arrays
# Based on http://techspot.zzzeek.org/2011/01/14/the-enum-recipe/
import six
from sqlalchemy.dialects import postgresql
from sqlalchemy.types import SchemaType, TypeDecorator, Enum
from sqlalchemy import __version__, text, cast
import re
if __version__ < '0.6.5':
raise NotImplementedError("Version 0.6.5 or higher of SQLAlchemy is required.")
@stefanhoth
stefanhoth / android-libs.md
Last active April 18, 2020 05:02
GDG Android in Berlin brainstorming session Collection of libraries that should be included as of today in a modern Android app-

#GDG Android in Berlin brainstorming session


On November 27, 2013 I was asking the brilliant Android developers at GDG Android in Berlin for their favorite libraries that make their lives easier and should be included in every newly developed app.

This is the list of libraries we collected during this 10 minute session.

Architecture

@mongolab-org
mongolab-org / watch-flip-flop.py
Last active August 5, 2016 23:05
check out http://mongolab.org/flip-flop/ for a more detailed explanation
#!/usr/bin/env python
# Written with pymongo-3.3
author__ = 'mongolab' \
import pymongo
import sys, datetime, time
import random
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 8, 2024 07:49
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
public class Analytics
{
// Tracker version.
private const string Version = "4.4sa";
private const string CookieName = "__utmmobile";
// The path the cookie will be available to, edit this to use a different
// cookie path.
private const string CookiePath = "/";
@RedBeard0531
RedBeard0531 / functions.js
Created February 22, 2012 20:13
Min, Max, Sum, Count, Avg, and Std deviation using MongoDB MapReduce
// derived from http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Parallel_algorithm
function map() {
emit(1, // Or put a GROUP BY key here
{sum: this.value, // the field you want stats for
min: this.value,
max: this.value,
count:1,
diff: 0, // M2,n: sum((val-mean)^2)
});
@rtgibbons
rtgibbons / mms-agent.sh
Created November 23, 2011 19:24
Centos init.d for mms-agent from 10Gen
#!/bin/bash
#
# /etc/rc.d/init.d/mms-agent
#
# 10Gen Mongod montiroing service
# must edit the settings.py first and edit this file with the location of agent.py
#
# description: 10Gen monitoring service - need ot fix pid so we can shut it down
# chkconfig: - 90 10