Skip to content

Instantly share code, notes, and snippets.

View chernjie's full-sized avatar

CJ (curl | jq) chernjie

View GitHub Profile
#!/usr/bin/env php
<?php
// if no arguments, take input from stdin
$argc < 2 && array_push($argv, file_get_contents("php://stdin"));
array_shift($argv);
$output = array();
#!/usr/bin/env bash
function _usage()
{
echo "$0 [php53|php54|php55|php56]"
}
function phpversion()
{
local _VERSION=$1
#!/usr/bin/env bash
variable_name="$1"
shift
while read "$variable_name"
do
eval "$(echo "$@" | sed s/"$variable_name"/'"'\$"$variable_name"'"'/g)"
done
@chernjie
chernjie / ubertrips.js
Last active October 8, 2017 18:04
Export Uber trips from https://riders.uber.com/trips
(function($){
var map = {
pickup: 1,
driver: 2,
fare: 3,
car: 4,
city: 5,
payment_method: 6
};
@chernjie
chernjie / sequelpro.sh
Created March 8, 2016 10:37
ssh script to overwrite ignoring of mutex on SequelPro > v1.1.0
#!/usr/bin/env bash
_log () {
echo $(date) $@ >> /var/log/sequelpro.log
}
for i do
case "$i"
in
-L\ *)
#!/usr/bin/env bash
_whack_a_mole_log=~/dotfiles/log/whack-a-mole.log
_whack_a_mole () {
printf $@:
while true
do
i=$(ps aux | grep $@ | grep -ve grep -ve whack-a-mole | awk '{print $2}')
@chernjie
chernjie / branch-cleanup.sh
Last active June 15, 2021 21:01
Find redundant branches and print commands to delete them
#!/usr/bin/env bash
COLOR_YELLOW(){ echo -en "\033[33m"; }
COLOR_RESET() { echo -en "\033[0m"; }
MAIN_BRANCH=${1:-master}
MAIN_REMOTE=${2:-origin}
label() {
echo -e "\033[33m$@\033[0m" >&2
@chernjie
chernjie / .editorconfig
Last active January 28, 2018 02:42
everwing
# EditorConfig is awesome: http://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
var table = $$('.emoji-card').map((el, i) => {
return {
emoji: el.firstChild.firstChild.innerHTML,
code: el.lastChild.firstChild.innerHTML,
description: el.lastChild.lastChild.innerHTML
};
}).reduce((table, el, i) => {
var tr = document.createElement('tr');
tr.innerHTML = '<td>' + el.emoji + '</td><td>' + el.code + '</td><td>' + el.description + '</td>';
table.appendChild(tr);
#!/usr/bin/env node
// time csvtojson data/order-interval-20180102.csv | node mockup/order-interval.js
var stdin = require('../../ppdg/ppdg-elk/src/stdinjson.js');
var lodash = require('lodash');
stdin(_process);
function _process (err, data) {
return lodash(data)