Skip to content

Instantly share code, notes, and snippets.

@toddsby
toddsby / keybase.md
Created March 14, 2021 18:49
Keybase identity

Keybase proof

I hereby claim:

  • I am toddsby on github.
  • I am toddsby (https://keybase.io/toddsby) on keybase.
  • I have a public key ASB-7BH7YLANjoaDktG4SCc3eTZ_DsohCtPQz1Tgu4ru8go

To claim this, I am signing this object:

@toddsby
toddsby / example-text.sh
Created July 16, 2019 07:10
create a text file and add some content
echo "insert text here" > myfile.txt
@toddsby
toddsby / x-replace-git-email.sh
Last active July 16, 2019 07:09
bash script git filter-branch change committer and author email
#!/bin/sh
echo "CHOOSE OPTION"
echo "[0] HEAD / [1] BRANCH NAME"
read REPLACE_EMAIL_OPTION
if [[ $REPLACE_EMAIL_OPTION = 0 ]]
then
GIT_BRANCH="HEAD"
else
@toddsby
toddsby / promise.js
Created March 5, 2018 18:50 — forked from wavded/promise.js
Promise A+ Implementation
"use strict"
var Promise = function () {
this.state = 'pending'
this.thenables = []
}
Promise.prototype.resolve = function (value) {
if (this.state != 'pending') return
this.state = 'fulfilled'
@toddsby
toddsby / docker-notes.sh
Last active April 15, 2020 11:35
docker notes
## SETUP DOCKER
Root User: docker
Root Pass: tcuser
/usr/local/bin/boot2docker up && export DOCKER_HOST=tcp://$(boot2docker ip 2>/dev/null):2375
boot2docker ssh ip addr show dev eth1
docker build -t mysql .
@toddsby
toddsby / destructuring.js
Created April 2, 2017 21:08 — forked from mikaelbr/destructuring.js
Several demos and usages for ES6 destructuring. Runnable demos and slides about the same topic: http://git.mikaelb.net/presentations/bartjs/destructuring
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => [1, 2, 3];
@toddsby
toddsby / .bash_profile
Last active March 1, 2017 00:29
.bash_profile and .bashrc (production)
export PATH=/usr/local/php-5.6/bin:/usr/local/php-5.6/sbin:$HOME/.rvm/bin:$PATH
alias gulp=node_modules/.bin/gulp
alias pm2=node_modules/.bin/pm2
alias lso="ls -alG | awk '{k=0;for(i=0;i<=8;i++)k+=((substr(\$1,i+2,1)~/[rwx]/)*2^(8-i));if(k)printf(\" %0o \",k);print}'"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
# Load NVM
export NVM_DIR="$HOME/.nvm"
@toddsby
toddsby / post-receive.sh
Last active March 1, 2017 00:27
Git deploy post-receive hook (production)
#!/bin/bash
while read oldrev newrev refname
do
branch=$(git rev-parse --symbolic --abbrev-ref $refname 2> /dev/null)
if [ "master" = "$branch" ]; then
(cd /home/tufandr/public_html/mightty && git --git-dir /home/tufandr/repos/mightty/.git --work-tree /home/tufandr/public_html/mightty checkout master -f && yarn && node_modules/.bin/gulp && node_modules/.bin/gulp 6to5ifyProd)
fi
done
@toddsby
toddsby / file.sh
Created February 26, 2017 03:57
Generate Self Signed SSL osx
sudo openssl req -x509 -nodes -days 3652 -newkey rsa:2048 -sha256 -keyout nginx-selfsigned.key -out nginx-selfsigned.crt
@toddsby
toddsby / php-fpm.conf
Created February 26, 2017 02:44
PHP 3.6.5 fpm config ubuntu 14
;;;;;;;;;;;;;;;;;;;;;
; FPM Configuration ;
;;;;;;;;;;;;;;;;;;;;;
; All relative paths in this configuration file are relative to PHP's install
; prefix (/usr/local/php-5.6). This prefix can be dynamically changed by using the
; '-p' argument from the command line.
; Include one or more files. If glob(3) exists, it is used to include a bunch of
; files from a glob(3) pattern. This directive can be used everywhere in the