Instantly share code, notes, and snippets.

Omar Abou Mrad omaraboumrad

View GitHub Profile
View splitlogs.py
# Requires pyyaml
import os
import yaml
run = os.system
new_window = lambda cmd: run('tmux new-window -n "logs" "{}"'.format(cmd))
split_vertical = lambda cmd: run('tmux split-window "{}"'.format(cmd))
split_horizontal = lambda cmd: run('tmux split-window -h "{}"'.format(cmd))
even_vertical = lambda: run('tmux select-layout even-vertical')
View chat_cli.py
import curses
(NORMAL, GREEN, RED, YELLOW, BLUE) = range(1,6)
(BUSY, AVAILABLE, IDLE) = (RED, GREEN, YELLOW)
WIN_CONTACTLIST_X = 0
WIN_CONTACTLIST_Y = 0
WIN_CONTACTLIST_WIDTH = 28
WIN_CONTACTLIST_HEIGHT = 0
View config.json
{
"nickname": "xnodeuser",
"username": "xnodeuser",
"hostname": "myhost",
"servername": "myserver",
"realname": "xnodeuser",
"channel": "#xnodeuser"
}
View TransitionButton.java
package info.aboumrad.transitiontest;
import android.content.Context;
import android.content.Intent;
import android.util.AttributeSet;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
public class TransitionButton extends Button {
View visualize.py
"""
Dependencies: pip install blockdiag
Run: python visualize.py
"""
from blockdiag import parser, builder, drawer
TEMPLATE = """
blockdiag {{ orientation = portrait
{}
View wiki.md

Setup

Assuming project is SOME/PROJECT And you are FOO

You will need to do the following one time only:

View git-cdiff
#!/usr/bin/env python
"""
Checks the commit difference between current branch and target branch
a la GitHub.
Usage:
$ git cdiff upstream/master
This branch is 5 commits ahead, 10 commits behind upstream/master.
View checkdependents.py
# Invert all requirements: python checkdependents.py
# View specific: python checkdependents.py somepackage
import collections
import sys
import pip
def invert_dependencies_graph(distributions):
packages = collections.defaultdict(list)
View bot.go
package main
import (
"bufio"
"fmt"
"gopkg.in/ini.v1"
"net"
"os"
"regexp"
"strings"
View sample.py
from toll import run, Toll
app = Toll(__name__)
@app.route(r'^/$')
def index():
return 'Hello World'