Skip to content

Instantly share code, notes, and snippets.

worker_processes 1;
events {
worker_connections 1024;
}
http {
send_timeout 1800;
sendfile on;
keepalive_timeout 6500;
server {
listen 80;
# usage: gl <file path>
gl()
{
git log --follow --date=short --pretty=format:"%h%x09%an%x09%ad%x09%s" -- $1 | sed '1!G;h;$!d'
}
# Usage: kc <pod name> <port>
kc()
{
toPort=$2
podname=$(kubectl get pods | grep $1 | head -n 1 | awk '{gsub(/ .+/, "", $1); print $1}')
echo $podname
port=$(kubectl describe pod $podname | grep Port | sed -n 1p | awk '{gsub(/[^0-9]+/,"", $2); print $2}')
echo $port
kubectl port-forward $podname $toPort:$port
}
@yusufnb
yusufnb / tabularize.js
Created June 14, 2016 17:54
Tabularize
/*
A handy utility function that converts
[[1,2,3],[false,"1bc",4,5]]
into
1 | 2 | 3
false | 1bc | 4 | 5
@yusufnb
yusufnb / gist:c22d6448c7e815f7bdf6
Last active January 12, 2017 19:25
Async Module Template
/**
Describe the module. Use what app provides.
*/
define(function (require) {
"use strict";
var app = require('app');
// Include your hard dependencies
#http://durdn.com/blog/2012/11/22/must-have-git-aliases-advanced-examples/
ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
gr = grep -Ii
la = "!git config -l | grep alias | cut -c 7-"
assume = update-index --assume-unchanged
unassume = update-index --no-assume-unchanged
assumed = "!git ls-files -v | grep ^h | cut -c 3-"
unassumeall = "!git assumed | xargs git update-index --no-assume-unchanged"
@yusufnb
yusufnb / pull request.md
Last active August 29, 2015 14:06
Creating a pull request

Creating a pull request

// On branch "release" - say
 
git checkout master
git pull
git checkout release
git pull
git branch feature
@yusufnb
yusufnb / elemView
Created May 31, 2014 07:55
View various DOM elements
* { background-color: rgba(255,0,0,.2); }
* * { background-color: rgba(0,255,0,.2); }
* * * { background-color: rgba(0,0,255,.2); }
* * * * { background-color: rgba(255,0,255,.2); }
* * * * * { background-color: rgba(0,255,255,.2); }
* * * * * * { background-color: rgba(255,255,0,.2); }
@yusufnb
yusufnb / heap.html
Created April 14, 2014 05:40
A simple heap in JavaScript
<script>
var Heap = (function(){
'use strict';
var arr = [];
function parent(i) {
return Math.floor((i+1)/2) - 1;
}
function left(i) {
return (i+1)*2 - 1;
}
@yusufnb
yusufnb / tmpl.php
Created May 18, 2012 18:32
Smallest Templating Engine
<?php
function view($tmpl, $args) {
$view_dir = 'views/';
foreach ($args as $k => $v) $$k = $v;
ob_start();
include ("$view_dir$tmpl.php");
return ob_get_clean();
}