Skip to content

Instantly share code, notes, and snippets.

View niltonvasques's full-sized avatar
🎯
Focusing

Nilton Vasques niltonvasques

🎯
Focusing
View GitHub Profile
@niltonvasques
niltonvasques / capybara.md
Created February 16, 2016 03:49 — forked from steveclarke/capybara.md
RSpec Matchers

Capybara

save_and_open_page

Matchers

have_button(locator)
@niltonvasques
niltonvasques / rspec-syntax-cheat-sheet.rb
Created February 16, 2016 05:54 — forked from dnagir/rspec-syntax-cheat-sheet.rb
RSpec 2 syntax cheat sheet by example
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")
@niltonvasques
niltonvasques / generate_roles.rb
Created February 16, 2016 07:02
Generate roles for all controllers
roles = Rails.application.routes.routes.map { |route| route.defaults[:controller] }.select { |i| not i.nil? }.uniq.select { |i| not i.match(/\//) }.reduce({}) { |h,i| h[i] = {index: true, new: false, create: false, edit: false, update: false, destroy: false }; h }
@niltonvasques
niltonvasques / pull_ssl_certificate.sh
Created March 7, 2016 21:17
Download SSL Certificate from Terminal
#!/bin/bash
# $1 - HOST
echo -n | openssl s_client -connect $1:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /tmp/$1.cert
@niltonvasques
niltonvasques / .bashrc
Last active May 31, 2017 21:51
Bash functions to stream and play youtube video and audio
# Install: https://github.com/rg3/youtube-dl/
# USAGE:
# play_youtube https://www.youtube.com/watch?v=4HLaOmiwV5Q&list=PLsVoIP7pW8g984pIJuKXhY9tTG1DiJWY9
function play_youtube(){
mplayer -fs -quiet $(youtube-dl -g -t "$1")
}
# USAGE:
# play_youtube_audio https://www.youtube.com/watch?v=4HLaOmiwV5Q&list=PLsVoIP7pW8g984pIJuKXhY9tTG1DiJWY9
function play_youtube_audio(){

I just had to set up Jenkins to use GitHub. My notes (to myself, mostly):

Detailed Instructions

For setting up Jenkins to build GitHub projects. This assumes some ability to manage Jenkins, use the command line, set up a utility LDAP account, etc. Please share or improve this Gist as needed.

Install Jenkins Plugins

@niltonvasques
niltonvasques / find_files_between_date.sh
Created April 6, 2016 05:07
Find all pdf files between some dates and move to current dir
#!/bin/bash
# FIND ALL PDF FILES THAT HAS BEEN ACCESSD BETWEEN SOME DATES AND MOVE TO CURRENT DIR
find ~/Documents -name \*.pdf -type f -newermt 2016-04-05 ! -newermt 2016-04-07 -exec mv -t ./ {} \+
@niltonvasques
niltonvasques / adk-db-pull.sh
Created June 29, 2016 18:32
Pull databases from android application
#!/bin/bash
# USAGE
# apk-db-pull.sh com.package.example
adb backup -f data.ab -noapk $1
dd if=data.ab bs=1 skip=24 | python -c "import zlib,sys;sys.stdout.write(zlib.decompress(sys.stdin.read()))" | tar -xvf -
@niltonvasques
niltonvasques / Makefile
Last active July 30, 2016 13:13
Basic android Makefile
APP_NAME=MyAppName
PACKAGE=com.example.package
CC=./gradlew
ADB=adb
.PHONY: build uninstall install log
all: build uninstall install log
@niltonvasques
niltonvasques / xp_sessions_notifier.sh
Created October 13, 2016 04:01
A script to manage XP programming sessions between coders.
#!/bin/bash
while true; do
sleep 20m
xmessage -buttons OK:0 -default OK -nearmouse "SESSION IS OVER!!!" -timeout 60
done