Skip to content

Instantly share code, notes, and snippets.

View chernjie's full-sized avatar

CJ (curl | jq) chernjie

View GitHub Profile
@chernjie
chernjie / git-ps1.source
Last active April 24, 2018 10:34
source git-ps1.source
#!/usr/bin/env bash
# Source git completion and git prompts
command -v __git_ps1 > /dev/null ||
for i in git-completion.bash git-prompt.sh
do
echo source ~/bin/$i
source ~/bin/$i
done
if declare -f __git_ps1 2>&1 >/dev/null
#!/bin/sh
rundir=/var/run/parallelLimit
pause_file="$rundir/paused"
harakiri_file="$rundir/good-day-to-die"
is-paused() {
[ -f "$pause_file" ]
}
@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
#!/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)
@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
};
#!/usr/bin/env bash
json2markdowntable () {
local headers=$@
echo $headers | sed "s, , | ,g"
seq $# | while read i; do echo " --- "; done | xargs | sed "s, , | ,g"
json -a $headers -d" | "
}
@chernjie
chernjie / hostname.sh
Created June 26, 2015 03:47
hostname.sh - Set hostname based on /etc/hostname
#! /bin/sh
### BEGIN INIT INFO
# Provides: hostname
# Required-Start:
# Required-Stop:
# Should-Start: glibc
# Default-Start: S
# Default-Stop:
# Short-Description: Set hostname based on /etc/hostname
# Description: Read the machines hostname from /etc/hostname, and
@chernjie
chernjie / logrotate.d-docker
Created April 17, 2015 17:31
Logrotate docker logs, copy this file to /etc/logrotate.d/docker
/var/lib/docker/containers/*/*-json.log {
dateext
daily
rotate 365
compress
delaycompress
missingok
}
@chernjie
chernjie / macsay.php
Last active October 25, 2016 13:17
Mac say in PHP
<?php
/**
* Declaring variables
*/
$output = array();
$return_var = null;
/**
* Get environment variables
@chernjie
chernjie / .gitignore
Last active June 10, 2016 06:14
hsg-door
success