Skip to content

Instantly share code, notes, and snippets.

View guillermo's full-sized avatar
😍
Processing request ...

Guillermo Álvarez guillermo

😍
Processing request ...
View GitHub Profile
@guillermo
guillermo / pre-commit.sh
Created January 3, 2012 16:53
javascript syntax check for a git pre-commit
#!/bin/sh
for js in $(git diff-index --name-only HEAD); do
echo Checking $js
if ( [ -f $js ] ); then
if jsl --process $js > /dev/null ; then
echo $js
else
echo "js files failed $js"
jsl -nologo -nofilelisting -nosummary --process $js
require "time"
party_time = Time.parse("5/04/2012 6:00:00 P.M.")
trap(:INT){puts ""}
loop do
seconds_left = party_time.to_i - Time.now.to_i
print "\rSeconds left to party: #{seconds_left}"
sleep(1)
end
@guillermo
guillermo / copy_dotfiles
Created May 8, 2012 09:55
Copy dot files in a faster way than scp
#!/bin/sh
#
# Usage
# copy_dotfiles user@machine
#
FILES=".vim .vimrc .inputrc .gitconfig"
cd $HOME
tar cL $FILES | ssh -C $1 'tar vx'
[
{
"id": 1,
"name": {
"first": "Guillermo",
"last": "Alvarez"
},
"child": [
{
"name": "pepe",
$ bundle install
Fetching source index for http://rubygems.org/
Using rake (0.9.2.2)
Installing rake-hooks (1.2.3)
Using bundler (1.0.21)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
😳 15:35:21 guillermo@Guillermos-MacBook-Pro:/tmp/asdf ruby-1.9.2-p290
$ cat Gemf
Gemfile Gemfile.lock
😳 15:35:21 guillermo@Guillermos-MacBook-Pro:/tmp/asdf ruby-1.9.2-p290
@guillermo
guillermo / gist:3131665
Created July 17, 2012 20:01
OpenStruct id method
$ cat test/test_id_method.rb
require 'test/unit'
require 'ostruct'
print "\n", RUBY_VERSION, "\n"
class TestIdMethod < Test::Unit::TestCase
def test_id_method
@guillermo
guillermo / fosdem.sh
Created February 2, 2013 11:53
Open all fosdem streams with cvlc
#!/bin/bash
quit()
{
jobs -p | xargs kill
}
trap quit SIGINT
cvlc http://streaming.fosdem.org/fosdem/janson.webm.m3u &
cvlc http://streaming.fosdem.org/fosdem/k-auditorium.webm.m3u &
@guillermo
guillermo / editor.sh
Last active December 15, 2015 14:59 — forked from ttscoff/editor.sh
#!/bin/bash
case $1 in
*_EDITMSG|*MERGE_MSG|*_TAGMSG )
/usr/local/bin/vim $1
;;
*.md|*.txt )
/usr/local/bin/mmdc $1
;;
* )
@guillermo
guillermo / rsa_test.go
Created May 31, 2013 23:02
Simple test that reads a use a private key in pem format, to encrypt and decrypt with rsa a message
package rsa_test
import (
"crypto/rand"
"crypto/rsa"
"crypto/sha1"
"crypto/x509"
"encoding/pem"
"io"
"testing"
@guillermo
guillermo / my_app.sh
Created January 15, 2014 08:27
This is a unix wrapper around the erlang vm.
#!/bin/bash
# This is a unix wrapper around the erlang vm. It provides the following functionality:
#
# * Spawns in foreground
# * Handle SIGHUP and call RELOADFUNC
# * Handle SIGTERM SIGQUIT and SIGINT telling to the vm to quit
# * Dies if the vm dies (for example kernel killing because out of memory)
#
# Forks and improvements are welcome.