Skip to content

Instantly share code, notes, and snippets.

View omaraboumrad's full-sized avatar

Omar Abou Mrad omaraboumrad

View GitHub Profile
@omaraboumrad
omaraboumrad / splitlogs.py
Created October 6, 2017 14:18
View docker-compose services logs in split tmux panes
# 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')
@omaraboumrad
omaraboumrad / chat_cli.py
Last active June 1, 2018 08:53
curses chat ui
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 December 20, 2016 11:21
irc bot written in javascript for nodejs
{
"nickname": "xnodeuser",
"username": "xnodeuser",
"hostname": "myhost",
"servername": "myserver",
"realname": "xnodeuser",
"channel": "#xnodeuser"
}
@omaraboumrad
omaraboumrad / TransitionButton.java
Created November 18, 2016 14:49
android declarative activity transition
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 October 28, 2016 13:45
Create a block diagram from a python class hierarchy using blockdiag
"""
Dependencies: pip install blockdiag
Run: python visualize.py
"""
from blockdiag import parser, builder, drawer
TEMPLATE = """
blockdiag {{ orientation = portrait
{}
@omaraboumrad
omaraboumrad / wiki.md
Last active October 23, 2024 00:51
How to contribute to a GitHub Project's Wiki

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 June 16, 2016 13:40
GitHub-like commit differences
#!/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 February 26, 2016 10:11
Check pip dependants instead of requires
# 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 January 2, 2016 08:16
irc bot in golang
package main
import (
"bufio"
"fmt"
"gopkg.in/ini.v1"
"net"
"os"
"regexp"
"strings"
@omaraboumrad
omaraboumrad / sample.py
Last active January 2, 2016 08:18
http url router
from toll import run, Toll
app = Toll(__name__)
@app.route(r'^/$')
def index():
return 'Hello World'