Skip to content

Instantly share code, notes, and snippets.

View ricardobeat's full-sized avatar

Ricardo Tomasi ricardobeat

View GitHub Profile
@ricardobeat
ricardobeat / .slate
Created March 28, 2014 10:51
slate config
config defaultToCurrentScreen true
config nudgePercentOf screenSize
config resizePercentOf screenSize
# Save and restore snapshot
bind 0:ctrl snapshot work3 save-to-disk
bind 0:ctrl;alt activate-snapshot work3
# Push Bindings
@ricardobeat
ricardobeat / .profile
Created March 21, 2014 10:30
Work .profile
source ~/ps1.sh
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced
alias ls='ls -GFh'
alias lsd='ls -d -- */'
#/usr/local/bin before /usr/bin
#export PATH='/usr/local/bin:$PATH'
@ricardobeat
ricardobeat / README.md
Last active April 14, 2020 18:19
git remaster

git-remaster updates both your current branch and master branch simultaneously, while preserving all commited, staged and unstaged changes.

Install

Add git-remaster to your path and make it executable:

curl https://gist.githubusercontent.com/ricardobeat/9600953/raw/git-remaster.sh > /usr/local/bin/git-remaster
chmod +x /usr/local/bin/git-remaster
@ricardobeat
ricardobeat / .profile
Last active December 25, 2015 05:39
simple PS1 for development VM
# Reset
Color_Off="\[\033[0m\]" # Text Reset
# Regular Colors
Black="\[\033[0;30m\]" # Black
Red="\[\033[0;31m\]" # Red
Green="\[\033[0;32m\]" # Green
Yellow="\[\033[0;33m\]" # Yellow
Blue="\[\033[0;34m\]" # Blue
Purple="\[\033[0;35m\]" # Purple
@ricardobeat
ricardobeat / serialize-multipart.js
Created September 20, 2013 04:28
JSON serialize to multipart form data
function serializeMultipart (obj, previous) {
var pairs = []
_.each(obj, function (value, key) {
if (previous !== undefined) {
key = previous + '[' + key + ']'
}
if (_.isArray(value)) {
_.each(value, function (value) {
pairs.push([key + '[]', value])
@ricardobeat
ricardobeat / npm-permissions.sh
Last active December 22, 2015 16:08
/usr/local permissions for NPM on Ubuntu. User should be part of the *admin* group.
sudo chgrp -R admin /usr/local/lib/node_modules
sudo chmod -R g+w /usr/local/lib/node_modules
@ricardobeat
ricardobeat / .gitconfig
Created September 9, 2013 14:02
Git config
[color]
ui = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
function soma (a, b) {
return a + b
}
module.exports = soma
@ricardobeat
ricardobeat / up.coffee
Last active December 20, 2015 20:29
coffeescript + generators
upload = (stream, idOrPath, tag, done) ->*
blob = blobManager.create(account)
tx = db.begin()
blobId = *blob.put(stream)
file = *self.byUuidOrPath(idOrPath).get()
prevId = file?.version
version = {
userAccountId : userAccount.id
@ricardobeat
ricardobeat / bandwidth.sh
Created July 17, 2013 20:01
Throttle localhost bandwidth
# First add a rule for all local traffic to port 80 to go into pipe 1
# 100 is the rule number which will be used for referencing the rule later
sudo ipfw add 100 pipe 1 ip from 127.0.0.1 to 127.0.0.1 dst-port http
# To display the rule use
# sudo ipfw show 100
# configure the settings of the pipe as you please
# 50kbit/s bandwidth
sudo ipfw pipe 1 config bw 50Kbit