Skip to content

Instantly share code, notes, and snippets.

@yoeun
yoeun / disable-gatekeeper.sh
Created April 15, 2019 02:28
Disable gatekeeper in MacOS
# Allow apps download from Anywhere on MacOS 10.12+
sudo spctl --master-disable
@yoeun
yoeun / git-update-all.sh
Last active December 9, 2019 16:59
Updates all local branches to latest upstream
git for-each-ref --shell --format="if [[ %(refname:short) != \"_ignore\"* ]] && [[ ! -z %(upstream) ]]; then git checkout %(refname:short) && git rebase %(upstream:short); fi" refs/heads/ | sh
@yoeun
yoeun / rm.sh
Created September 20, 2016 18:27
Fast method to delete all files in a large folder
# when 'rm -rf *' fails with 'Argument list too long'
printf '%s\0' * | xargs -0 rm
@yoeun
yoeun / manualMouseEvent.js
Last active December 8, 2016 22:35
Manual mouse event using document.createEvent() and element.dispatchEvent()
// modern
var evt = new Event("mouseup", {"bubbles":true, "cancelable":true});
document.querySelector(".foo-bar").dispatchEvent(evt);
// deprecated
var evt = document.createEvent("MouseEvents");
evt.initEvent("mouseup", true, true);
document.querySelector(".foo-bar").dispatchEvent(evt);
@yoeun
yoeun / .ackrc
Last active August 29, 2015 14:07
# follow symlinks
--follow
--type-set=scss=.scss
--type-set=http=.http
--type-set=coffee=.coffee
--type-set=orig=.orig
--ignore-dir=tiny_mce
--ignore-dir=external
--ignore-dir=timeline_2.3.0
--ignore-dir=codemirror-0.91
@yoeun
yoeun / .vimrc
Last active August 29, 2015 14:07
Plugins managed using Vundle [https://github.com/gmarik/Vundle.vim]
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
@yoeun
yoeun / hgblame.sh
Created August 1, 2014 22:49
hg blame
hg annotate --user --number
@yoeun
yoeun / subl
Last active November 14, 2017 09:49
subl command on linux
#!/bin/sh
# save to /usr/local/bin/subl
nohup /path/to/Sublime\ Text\ 2/sublime_text $1 >/dev/null 2>&1 &
@yoeun
yoeun / disable-chrome-gesture.sh
Last active August 29, 2015 14:02
Disable swipe in Chrome (Mac)
# Mavericks
defaults write com.google.Chrome AppleEnableSwipeNavigateWithScrolls -bool FALSE
# Older versions of OS X
defaults write com.google.Chrome.plist AppleEnableSwipeNavigateWithScrolls -bool FALSE
@yoeun
yoeun / init-services.sh
Last active August 29, 2015 13:56
Launch service on startup (Homebrew)
# For programs installed via Homebrew
ln -sfv /usr/local/opt/rabbitmq/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.rabbitmq.plist
ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
# etc...