Skip to content

Instantly share code, notes, and snippets.

View coderfi's full-sized avatar

Fairiz 'Fi' Azizi coderfi

View GitHub Profile
@coderfi
coderfi / ipyD3.py
Last active December 21, 2015 06:39 — forked from z-m-k/LICENSE
Updated for use with iPython 1.0.0 notebook (use the IPython.display.HTML method). Added phantomExec arg to d3object function (defaults to 'phantomjs'... so keep it in your path)
from __future__ import division
import numpy
from uuid import uuid1
class d3object:
def __init__(self,
height=100,
width=100,
topHtml='',
bottomHtml='',
style=None,
from __future__ import print_function
from nanomsg import Socket, REQ, REP, PUB, SUB, DONTWAIT, \
NanoMsgAPIError, EAGAIN, SUB_SUBSCRIBE
import time
from gevent import monkey
import gevent
monkey.patch_all()
upstream some_app_server {
server 127.0.0.1:9393;
}
server {
listen 80;
server_name my-upload-endpoint.com ;
// This systemd runs iptables-restore on boot:
[Unit]
Description=Packet Filtering Framework
DefaultDependencies=no
After=systemd-sysctl.service
Before=sysinit.target
[Service]
Type=oneshot
ExecStart=/usr/sbin/iptables-restore /opt/docker/scripts/iptables/iptables.rules
@coderfi
coderfi / timeit_sample.py
Created August 3, 2014 19:01
See the timing difference between using for loops and itertools
from itertools import ifilter
import sys
import timeit
REPEAT = 3
EXECUTIONS = 10000
VALUES = range(0, 10000)
def double(x):
return x*2
@coderfi
coderfi / hiverc
Last active April 25, 2018 15:30
-- set hive.exec.reducers.bytes.per.reducer=<number>
-- set hive.exec.reducers.max=<number>
-- set mapred.reduce.tasks=<number>
set hive.exec.dynamic.partition.mode=nonstrict;
set hive.optimize.ppd=true;
add jar /opt/mapr/hadoop/hadoop-0.20.2/contrib/streaming/hadoop-0.20.2-dev-streaming.jar;
add jar /opt/jars/parquet-hive-bundle-1.2.10.jar;
@coderfi
coderfi / README.md
Last active August 29, 2015 14:07 — forked from agnoster/README.md

agnoster.zsh-theme

A ZSH theme optimized for people who use:

  • Solarized
  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

For Mac users, I highly recommend iTerm 2 + Solarized Dark

@coderfi
coderfi / luigi_email_attachment.py
Created November 3, 2014 22:03
python xlsx email attachment (with luigi helpers)
from luigi import notifications, configuration
import smtplib
import email
import datetime
def send_email(subject, message, xlsx_fn, sender, recipients):
if not isinstance(recipients, (list, tuple, set)):
recipients = [ recipients ]
config = configuration.get_config()
#!/usr/bin/env bash
# Run this script inside a SVN checkout of the project
authors=$(svn log -q | grep -e '^r' | awk 'BEGIN { FS = "|" } ; { print $2 }' | sort | uniq)
for author in ${authors}; do
echo "${author} = NAME <USER@DOMAIN>";
.timeline {
list-style: none;
padding: 20px 0 20px;
position: relative;
}
.timeline:before {
top: 0;
bottom: 0;
position: absolute;