Skip to content

Instantly share code, notes, and snippets.

View randomecho's full-sized avatar
🚽
Developer

Soon Van randomecho

🚽
Developer
View GitHub Profile
@randomecho
randomecho / melt.sh
Last active December 1, 2017 16:54
Merge and then delete traces of feature branch
#!/bin/sh
feature_branch=$(git branch | grep \* | sed 's/\* //')
all_branches=$(git branch | tr '\n' ' ')
main_branch=$1
if [[ $all_branches != *$main_branch* ]]; then
echo "$main_branch is not a valid branch to merge back into"
exit 1
fi
-module(patterns).
-export([exxor/2,exxot/2,exxon/2,efix/2,maxThree/3,howManyEqual/3]).
exxor(X,Y) ->
X =/= Y.
exxot(X,Y) ->
X == Y.
exxon(X,Y) ->
@randomecho
randomecho / .gitconfig
Last active April 2, 2019 15:53
Git aliases
[alias]
soonvan = commit -m \"Created by Soon Van - randomecho.com\"
purple = commit -am \"purple monkey dishwasher\"
hist = log --pretty=format:\"%h %ad | %s%d\" --graph --date=short
histo = log --max-count=12 --pretty=format:\"%h %ad %s%d\" --graph --date=short
search = !sh -c 'git log --max-count=12 --grep=$1 --pretty=format:\"%h%C(bold yellow) %s%C(reset)\"' -
undo = reset --soft HEAD~
edit = commit --amend
twt = !git add twitter.txt
waxy = !git add wax* && git s
@randomecho
randomecho / .bashrc
Last active January 24, 2016 14:07
Save in ~/.bashrc and reload with `source ~/.bashrc`
# .bashrc
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias elog='tail -f /var/log/httpd/error_log'
alias loga='tail -f /var/log/httpd/access_log'
alias sugar='tail -f sugarcrm.log'
alias web='cd /srv/httpd/'
alias phpunit='custom/vendor/bin/phpunit --color'
@randomecho
randomecho / underscored.rb
Last active January 18, 2016 03:14
mv folders to have underscore prefix
#!/usr/bin/env ruby
#
# mv folders to have underscore prefix
#
# Author:: Soon Van - randomecho.com
# Copyright:: Copyright 2016 Soon Van
# License:: http://opensource.org/licenses/BSD-3-Clause
require 'FileUtils'
@randomecho
randomecho / purge_empties.rb
Last active January 18, 2016 03:14
Delete empty directories recursively
#!/usr/bin/env ruby
#
# Delete empty directories recursively
#
# Author:: Soon Van - randomecho.com
# Copyright:: Copyright 2016 Soon Van
# License:: http://opensource.org/licenses/BSD-3-Clause
require 'FileUtils'
@randomecho
randomecho / bash_profile
Last active August 29, 2015 14:11
Custom Git settings on a Mac OS bash prompt
# ~/.bash_profile
export PATH="/usr/local/bin:/usr/local/sbin:~/bin:$PATH"
# Auto-completion helper when you hit tab
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
@randomecho
randomecho / keybase.md
Created October 3, 2014 03:33
Keybase.io proof

Keybase proof

I hereby claim:

  • I am randomecho on github.
  • I am randomecho (https://keybase.io/randomecho) on keybase.
  • I have a public key whose fingerprint is 119D F84C 21E4 E785 9C66 6D17 F21A BCE5 326C 3BC0

To claim this, I am signing this object:

@randomecho
randomecho / phpinfo-dump.php
Created June 27, 2014 03:23
Grab, strip and dump out phpinfo() into part of a page, neutering some of its overriding HTML and styles.
ob_start();
phpinfo();
$phpInfo = ob_get_clean();
$phpInfo = preg_replace('/600(px)?/', '100%', $phpInfo); // table and hr width
$phpInfo = str_replace('75%', '95%', $phpInfo); // font-size
$phpInfo = preg_replace('/<?([\w]|<|\/|>)*(a:|!DOCTYPE|<html|title|body)(.+)?\\n?/', '', $phpInfo); // main html doc tags
@randomecho
randomecho / db.php
Last active December 18, 2015 09:38
Database hookup for wrapping around PDO
<?php
/**
* Database hookup for wrapping around PDO
*
* @author Soon Van - randomecho.com
* @copyright 2013 Soon Van
* @license http://www.opensource.org/licenses/BSD-3-Clause
*/
class DB {