Skip to content

Instantly share code, notes, and snippets.

View xymor's full-sized avatar

Raphael Miranda xymor

View GitHub Profile
@xymor
xymor / es.sh
Last active December 12, 2015 01:38 — forked from kajic/es.sh
cd ~
#sudo apt-get update
#sudo apt-get install curl python-software-properties -y
#sudo apt-get install openjdk-6-jre-headless
curl -L https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.18.7.tar.gz | tar -xz
sudo mv elasticsearch-* /usr/local/share/elasticsearch
curl -L http://github.com/elasticsearch/elasticsearch-servicewrapper/tarball/master | tar -xz
sudo mv *servicewrapper*/service /usr/local/share/elasticsearch/bin/
rm -Rf *servicewrapper*
@xymor
xymor / gist:5025721
Last active December 14, 2015 04:08
Ruby Euler #3
#print the largest prime factor a number
#this is the most elegant way and work ok for large numbers
require 'prime'
Prime.prime_division(big_number).max()
# Not using Prime which has pretty bad performance before 1.9
# and using tail recursion which is cool as fast
@xymor
xymor / definition
Last active June 7, 2018 06:38
script to automatically attach and detach an EC2::Instance from elbs
Our architecture uses an Ec2:Instance to define a master,
such instance doesn't have the automatic management of elb attachment
provided by the AWS::AutoScaling::AutoScalingGroup to slaves so
this script roughly replicates it by attaching an instance
upon boot and releasing it during shutdown.
@xymor
xymor / gist:9571659
Last active August 29, 2015 13:57
elasticsearch.yml
cluster.name: "elasticsearch"
path.data: /mnt/elasticsearch/data
path.work: /mnt/elasticsearch/work
path.logs: /mnt/elasticsearch/logs
path.plugins: /mnt/elasticsearch/plugins
http.enabled: true
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["127.0.0.1:[9300-9400]"]
node.master: true
node.data: true
@xymor
xymor / gist:9728719
Created March 23, 2014 19:43
My dsl line is down so I'm tethering my 3G from Vivo carrier in brazil
64 bytes from 74.125.196.104: icmp_seq=183 ttl=40 time=45015.622 ms
64 bytes from 74.125.196.104: icmp_seq=184 ttl=40 time=44225.732 ms
64 bytes from 74.125.196.104: icmp_seq=185 ttl=40 time=43580.101 ms
64 bytes from 74.125.196.104: icmp_seq=186 ttl=40 time=43071.082 ms
64 bytes from 74.125.196.104: icmp_seq=187 ttl=40 time=42308.954 ms
64 bytes from 74.125.196.104: icmp_seq=188 ttl=40 time=41622.076 ms
4 bars...
@xymor
xymor / github-backup.rb
Created May 14, 2014 16:10
Gihub Backup
#gitback 0.1
#credits: Walter White, Updates: Addy Osmani
#!/usr/bin/env ruby
# dependencies
require "yaml"
require "open-uri"
# your github username
username = "addyosmani"
@xymor
xymor / whitelist-ssl.sh
Last active September 28, 2016 01:19
Java whitelist ssl certificate
keytool -printcert -sslserver secure.fcontrol.com.br -rfc > fcontrol.pem
#alternative: openssl s_client -quiet -showcerts -connect secure.fcontrol.com.br:443 | sed -n '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > fcontrol.pem
keytool -import -trustcacerts -alias secure.fcontrol.com.br -file fcontrol.pem -keystore /home/raphaelm/projects/git-repos/ideais-kanlo/etc/kanlo2/vmfiles/etc/pki/java/cacerts
#list trusted certificates
keytool -list -keystore /home/raphaelm/projects/git-repos/ideais-kanlo/etc/kanlo2/vmfiles/etc/pki/java/cacerts
@xymor
xymor / perm.groovy
Created June 22, 2014 02:32
Repenting for my sins
/*
Once upon a time I got an interview with CosmicCart. I had a skype call at 7am but totally forgot about it
and went out drinking the previous night. I got home at 4am very drunk, got up at 6:30 with a killing
hangover and totally flunked that interview.
I finished the 2 element permutation, then he asked me to do the 3 element combination
and I couldn't think straight to solve it.
This is my repentance. I'll get to the n-element method and cleanse my soul.
@xymor
xymor / ComponentTagLib.groovy
Last active August 29, 2015 14:04
Grails CMS
package commerce.catalog.cms
import grails.util.*
class ComponentTagLib {
def storeService, resourceService, groovyPagesTemplateEngine, cacheUtils, grailsApplication, cookieManager
def section = { attrs ->
def store = storeService.getStore()
@xymor
xymor / dump.txt
Created August 18, 2014 22:02
Remembered Networks, it's geekier than taking photos during trips.
defaults read /Library/Preferences/SystemConfiguration/com.apple.airport.preferences RememberedNetworks | grep SSIDString
SSIDString = Waraiotoko;
SSIDString = "MIA-WiFi";
SSIDString = "SFO-WiFi";
SSIDString = "States Together";
SSIDString = "Meteor Guest";
SSIDString = Iacocca;
SSIDString = "Heineken Domes";
SSIDString = RedeWiFiInfraero;