Skip to content

Instantly share code, notes, and snippets.

View rafaelfelini's full-sized avatar
🏠
Working from home

Rafael Felini rafaelfelini

🏠
Working from home
View GitHub Profile
@rafaelfelini
rafaelfelini / remove_file_from_git.sh
Created November 4, 2011 01:01
Remove files in .gitignore from version control
git rm -r --cached .
git add .
git commit -m ".gitignore is now working"
@rafaelfelini
rafaelfelini / ltm.clj
Created December 15, 2011 00:09 — forked from paulosuzart/mkhash.clj
Makes a clojure Map from a given coll.
(defn ltm
"Makes a clojure map from a given collection. lst should have an even number of elements"
[lst]
(reduce merge
(map (fn [l] { (first l) (second l) } ) (partition 2 lst))))
;kudos to @paulosuzart
;user=> (ltm '(:a 1 :b 2 :c 3 :d 4))
;{:d 4, :c 3, :b 2, :a 1}
@rafaelfelini
rafaelfelini / ltm.clj
Created December 15, 2011 00:27 — forked from paulosuzart/ltm.clj
Makes a clojure Map from a given coll.
(defn ltm
"Makes a clojure map from a given collection. lst should have an even number of elements"
[lst]
(reduce merge
(map (fn [l] {(keyword (str (first l))) (second l)}) (partition 2 lst))))
;;kudos to @paulosuzart
;;user=> (ltm '(:a 1 :b 2 :c3 :d 4))
;;{:c3 :d, :b 2, :a 1}
@rafaelfelini
rafaelfelini / ux_referencias
Created February 13, 2012 13:53 — forked from eshiota/ux_referencias
UX para Developers - Referências
# UX para Developers - Referências
## Soluções prontas
- Bootstrap from Twitter (http://twitter.github.com/bootstrap)
- jQuery Mobile (http://www.jquerymobile.com)
- HTML 5 Boilerplate (http://html5boilerplate.com)
## Ferramentas
@rafaelfelini
rafaelfelini / elasticsearch-parent-child-example.sh
Created October 11, 2013 02:48
Elasticsearch parent child query with filter example
curl -XPOST localhost:9200/skus/sku/_search -d '{
"query":{
"filtered":{
"query":{
"match_all":{
}
},
"filter":{
"has_child":{
@rafaelfelini
rafaelfelini / chef install java.sh
Created November 4, 2013 00:57
Test install java with chef
sudo su
cd
curl -L https://www.opscode.com/chef/install.sh | bash
chef-solo -v
cd
rm -rf *
rm -rf .chef/
@rafaelfelini
rafaelfelini / chef install nginx.sh
Created November 4, 2013 00:57
Test install nginx with chef
sudo su
cd
curl -L https://www.opscode.com/chef/install.sh | bash
chef-solo -v
cd
rm -rf *
rm -rf .chef/
@rafaelfelini
rafaelfelini / get-instance-tag-name.sh
Created September 22, 2014 17:18
Get aws ec2 instance name via tag.
export AWS_ACCESS_KEY_ID=
export AWS_SECRET_ACCESS_KEY=
TAG_NAME="Name"
INSTANCE_ID="`wget -qO- http://instance-data/latest/meta-data/instance-id`"
REGION="`wget -qO- http://instance-data/latest/meta-data/placement/availability-zone | sed -e 's:\([0-9][0-9]*\)[a-z]*\$:\\1:'`"
TAG_VALUE="`aws ec2 describe-tags --filters "Name=resource-id,Values=$INSTANCE_ID" "Name=key,Values=$TAG_NAME" --region $REGION --output=text | cut -f3`"
echo "hostname=$TAG_VALUE"
@rafaelfelini
rafaelfelini / TimeoutServer.groovy
Created December 29, 2014 20:04
Groovy timeout dummy server
import java.net.*
def server = new ServerSocket(443, Integer.MAX_VALUE, InetAddress.getByName("dev.simbo.realties.s3.amazonaws.com"))
while(true) {
server.accept { socket ->
println "processing new connection..."
socket.withStreams { input, output ->
def reader = input.newReader()
def buffer = reader.readLine()
@rafaelfelini
rafaelfelini / s3.sh
Last active August 29, 2015 14:22 — forked from chrismdp/s3.sh
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine
# This is how I upload my new Sol Trader builds (http://soltrader.net)
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash
S3KEY="my aws key"
S3SECRET="my aws secret" # pass these in
function putS3
{
path=$1