Skip to content

Instantly share code, notes, and snippets.

Omar Abou Mrad omaraboumrad

View GitHub Profile
@omaraboumrad
omaraboumrad / splitlogs.py
Created Oct 6, 2017
View docker-compose services logs in split tmux panes
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
@omaraboumrad
omaraboumrad / config.json
Last active Dec 20, 2016
irc bot written in javascript for nodejs
View config.json
{
"nickname": "xnodeuser",
"username": "xnodeuser",
"hostname": "myhost",
"servername": "myserver",
"realname": "xnodeuser",
"channel": "#xnodeuser"
}
@omaraboumrad
omaraboumrad / TransitionButton.java
Created Nov 18, 2016
android declarative activity transition
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 {
@omaraboumrad
omaraboumrad / visualize.py
Last active Oct 28, 2016
Create a block diagram from a python class hierarchy using blockdiag
View visualize.py
"""
Dependencies: pip install blockdiag
Run: python visualize.py
"""
from blockdiag import parser, builder, drawer
TEMPLATE = """
blockdiag {{ orientation = portrait
{}
@omaraboumrad
omaraboumrad / wiki.md
Last active Jun 21, 2016
How to contribute to a GitHub Project's Wiki
View wiki.md

Setup

Assuming project is SOME/PROJECT And you are FOO

You will need to do the following one time only:

@omaraboumrad
omaraboumrad / git-cdiff
Last active Jun 16, 2016
GitHub-like commit differences
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.
@omaraboumrad
omaraboumrad / checkdependents.py
Created Feb 26, 2016
Check pip dependants instead of requires
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)
@omaraboumrad
omaraboumrad / bot.go
Created Jan 2, 2016
irc bot in golang
View bot.go
package main
import (
"bufio"
"fmt"
"gopkg.in/ini.v1"
"net"
"os"
"regexp"
"strings"
@omaraboumrad
omaraboumrad / sample.py
Last active Jan 2, 2016
http url router
View sample.py
from toll import run, Toll
app = Toll(__name__)
@app.route(r'^/$')
def index():
return 'Hello World'
You can’t perform that action at this time.