Skip to content

Instantly share code, notes, and snippets.

View bltavares's full-sized avatar
💭
I may be slow to respond.

Bruno Tavares bltavares

💭
I may be slow to respond.
View GitHub Profile
@bltavares
bltavares / README.md
Created February 18, 2013 17:12
Hubot script - Pipeline reporter

Before starting up, set the environment variable HUBOT_PIPELINE_URL to point to the pipeline url.

@bltavares
bltavares / gist:5068895
Created March 1, 2013 23:57
CouchDb compilation error
/usr/bin/erlc etap_request.erl
etap_request.erl:26: parameterized modules are no longer supported
etap_request.erl:49: variable 'OutBody' is unbound
etap_request.erl:56: variable 'Method' is unbound
etap_request.erl:59: variable 'Url' is unbound
etap_request.erl:62: variable 'Status' is unbound
etap_request.erl:66: variable 'Status' is unbound
etap_request.erl:71: variable 'Status' is unbound
etap_request.erl:75: variable 'OutHeaders' is unbound
etap_request.erl:79: variable 'OutHeaders' is unbound
@bltavares
bltavares / toggle.sh
Created March 10, 2013 00:54
Toggle window or open the program
#!/bin/bash
tool1=$(which xdotool)
tool2=$(which wmctrl)
if [ -z $tool1 ]; then
echo "Xdotool is needed, do you want to install it now? [Y/n]"
read a
if [[ $a == "Y" || $a == "y" || $a = "" ]]; then
sudo apt-get install xdotool
@bltavares
bltavares / Guardfile
Created April 11, 2013 19:51
Guardfile for mocha
# encoding: utf-8
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
notification :terminal_notifier_guard
guard :shell, :all_on_start => true do
watch(/^(test|lib)\/.+/) do
status = `./node_modules/mocha/bin/mocha 2>&1`.force_encoding("utf-8")
@bltavares
bltavares / .autostart
Created May 12, 2013 14:56
Autostart VOSTRO 3500
setxkbmap -layout "comprehensive(br)"
MSKB=`xinput -list | grep Microsoft | grep keyboard | cut -f 2 | cut -c 4-`
if [[ -n "$MSKB" ]]; then
setxkbmap -device $MSKB -layout "comprehensive(us)"
fi
synclient TapButton1=1 VertEdgeScroll=1 HorizEdgeScroll=1 CircScrollTrigger=2
xmodmap -e 'pointer = 1 2 3 5 4 7 6 8 9 10 11 12'
xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Pressure" 32 10
xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Width" 32 8
function countNeighbours(grid, columnIndex, rowIndex){
var getCellValueForGrid = getCellValue.bind(this, grid);
var zipForPosition = zipWithSum.bind(this, [rowIndex, columnIndex]);
return [[-1,-1],[-1,0],[-1,1],
[-1, 0], [ 1,0],
[ 1,-1],[ 1,0],[ 1,1]].reduce(function(a,b) {
return a + getCellValueForGrid.apply(this, zipForPosition(b));
},0);
}
(defproject tabletop "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:plugins [[lein-cljsbuild "0.3.2"]
[lein-ring "0.8.6"]]
:hooks [leiningen.cljsbuild]
:dependencies [[org.clojure/clojure "1.5.1"]
[compojure "1.1.5"]
pair@btavare ~ % baseline init sample
Cloning into '.baseline'...
remote: Counting objects: 1371, done.
remote: Compressing objects: 100% (926/926), done.
remote: Total 1371 (delta 346), reused 1311 (delta 315)
Receiving objects: 100% (1371/1371), 1.18 MiB | 718.00 KiB/s, done.
Resolving deltas: 100% (346/346), done.
Checking connectivity... done
pair@btavare ~ % cd sample
pair@btavare ~/repos/vagrant-baseline % (coreyhaines-master) 
pair@btavare ~/repos/vagrant-baseline % (coreyhaines-master) DEBUG=1 host_name=ruby-ruby193 vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
@bltavares
bltavares / Main.java
Last active December 21, 2015 07:48
Follow the error: Spring Autowired and bean collectors
import com.example.ObjectsExtractor;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class Main {
public static void main(String[] args) {
new ClassPathXmlApplicationContext("context.xml")
.getBean(ObjectsExtractor.class);
}
}