Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Lucas Arruda LucasArruda

🏠
Working from home
View GitHub Profile
View fix_brew.sh
#!/bin/sh
cd $(brew --prefix) && git fetch && git reset --hard origin/master
brew update
@LucasArruda
LucasArruda / add-css-vanilla.js
Last active Aug 29, 2015
Add CSS or JS on the fly
View add-css-vanilla.js
function loadCss(url) {
var link = document.createElement("link");
link.type = "text/css";
link.rel = "stylesheet";
link.href = url;
document.getElementsByTagName("head")[0].appendChild(link);
}
View uri.js
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
View keybase.md

Keybase proof

I hereby claim:

  • I am lucasarruda on github.
  • I am lucasarruda (https://keybase.io/lucasarruda) on keybase.
  • I have a public key whose fingerprint is F895 D87F A05A 3939 8E1D A9BF E6A0 E155 A547 ACD7

To claim this, I am signing this object:

@LucasArruda
LucasArruda / quick-deploy-heroku-git.txt
Last active Aug 29, 2015
Quick deploy to Heroku from git repo
View quick-deploy-heroku-git.txt
## summary
git remote add heroku git@heroku.com:heroku_app_name.git
git push heroku master
heroku open
## commented steps
# (if you haven't) add keys to heroku so you can push
heroku keys:add
View create-iso-from-dvd.sh
#!/bin/sh
# see what's the correct disk #
mount
# change disk2 to correct disc number
sudo diskutil unmount /dev/disk2
dd if=/dev/disk1 of=~/mydvd.iso bs=2048 conv=sync,notrunc
@LucasArruda
LucasArruda / cup.py
Last active Aug 29, 2015
World Cup 2014 results on terminal
View cup.py
from urllib2 import urlopen
import json
resp = urlopen('http://worldcup.sfg.io/matches/?by_date=DESC').read()
for jogo in json.loads(resp):
complete = (jogo['status'] == 'completed')
current = (jogo['status'] == 'in progress')
if complete or current:
ht = jogo['home_team']
View whiteboardCleaner.md

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert $1 -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 $2

Results

View Gruntfile.js
module.exports = function(grunt) {
var config = {};
// Set all the tasks you want to load.
var tasks = [
, "grunt-contrib-concat"
, "grunt-contrib-uglify"
, "grunt-contrib-jshint"
, "grunt-contrib-watch"
];
View install-git-completion.sh
GIT_VERSION=`git --version | awk '{print $3}'`
URL="https://raw.github.com/git/git/v$GIT_VERSION/contrib/completion/git-completion.bash"
OTHER_URL="https://raw.githubusercontent.com/git/git/v$GIT_VERSION/contrib/completion/git-completion.bash"
PROFILE="$HOME/.profile"
echo "Downloading git-completion for git version: $GIT_VERSION..."
if ! curl "$URL" --silent --output "$HOME/.git-completion.bash"; then
echo "ERROR: Couldn't download completion script. Make sure you have a working internet connection." && exit 1
You can’t perform that action at this time.