Skip to content

Instantly share code, notes, and snippets.

View chernjie's full-sized avatar

CJ (curl | jq) chernjie

View GitHub Profile
@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
#!/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 / 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\ *)
@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
variable_name="$1"
shift
while read "$variable_name"
do
eval "$(echo "$@" | sed s/"$variable_name"/'"'\$"$variable_name"'"'/g)"
done
#!/usr/bin/env bash
function _usage()
{
echo "$0 [php53|php54|php55|php56]"
}
function phpversion()
{
local _VERSION=$1
#!/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
# Set the following SSH configurations to no:
# ChallengeResponseAuthentication
# PasswordAuthentication
# UsePAM
test -f /etc/ssh/sshd_config || exit 1
sed -i -r -e \
@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 / .gitignore
Last active June 10, 2016 06:14
hsg-door
success