Skip to content

Instantly share code, notes, and snippets.

View rodvlopes's full-sized avatar
🎯
Focusing

Rodrigo Lopes rodvlopes

🎯
Focusing
View GitHub Profile
@rodvlopes
rodvlopes / cruisecontrolrb
Created January 25, 2010 13:12
init/rc cruisecontrol.rb daemon
#! /bin/sh
### BEGIN INIT INFO
# Provides: cruisecontrol.rb
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: S 0 1 6
# Short-Description: CruiseControl.rb
# Description: Continuous build integration system. This runs the web interface (via mongrel and the builders).
### END INIT INFO
@rodvlopes
rodvlopes / lru.rb
Created July 11, 2011 04:54
LRU Algorithm
#!/usr/bin/env ruby
# O algoritmo LRU (Least Recently Used) é utilizado em sistemas operacionais como método
# de substituição de páginas. Considerando que 4 páginas são alocadas na memória principal,
# após a requisição das páginas 4, 7, 5, 7, 6, 7, 10, 4, 8, 5, 8, 6, 8, 11, 4, 9, 5, 9, 6,
# 9, 12, 4, 7, 5, 7 o número de falhas de página (page faults) será
# (A) 15 (B) 17 (C) 19 (D) 21 (E) 23
@rodvlopes
rodvlopes / wifistrength.sh
Created March 29, 2012 02:07
Script para exibir a cada segundo a força do sinal da rede sem fio conectada
#!/bin/sh
#author: rodvlopes
while true
do
echo `date "+%H:%M:%S"` `iwconfig wlan0|grep Signal|cut -d"=" -f3|cut -d" " -f1`
sleep 1
done
@rodvlopes
rodvlopes / respostas.rb
Created March 29, 2012 03:33
Lista de respostas das questões do concurso de analista de sistemas da Petrobras
#!/usr/bin/env ruby
# encoding: utf-8
PROVAS = {
:petro_pro_2010 => %q(A,C,A,B,E,B,E,A,C,B,B,E,B,D,A,B,C,E,E,B,D,D,E,E,D,C,C,E,D,A,C,A,A,D,E,D,A,B,C,A,A,A,D,E,C,D,A,E,A,B,D,D,A,A,E,C,D,E,B,D,E,D,A,A,B,A,C,D,E,B).split(','),
:petro_eng_2010 => %q(C,B,B,E,A,E,E,D,A,D,A,B,C,A,B,C,D,B,E,C,A,E,D,C,C,B,E,E,B,A,D,B,B,A,A,C,A,D,A,C,C,B,D,D,D,D,A,D,E,C,E,B,E,D,A,B,B,X,A,B,E,C,X,D,A,B,C,D,D,E).split(','),
:petro_eng_2011 => %q(C,D,B,A,A,A,E,B,C,A,C,A,A,C,E,B,D,D,E,D,E,C,D,A,D,B,A,A,C,C,A,B,D,D,E,C,B,C,C,X,D,A,E,C,C,A,B,C,B,E,B,C,E,A,C,C,E,C,D,A,D,E,A,A,B,X,A,E,A,B).split(',')
}
def main
@rodvlopes
rodvlopes / unity-monitor.py
Last active December 19, 2015 19:48
Ubuntu Unity Indicator to monitor HTTP services. Any service that returns text "ok". Read services urls from external file services.cfg. No need to restart after changing the configuration file.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import gtk
import appindicator
import urllib2
import re
import os
from ConfigParser import ConfigParser
@rodvlopes
rodvlopes / st3keys
Created August 27, 2014 16:13
SublimeText 3 Key binds
[
{ "keys": ["ctrl+alt+d"], "command": "find_under_expand" },
{ "keys": ["ctrl+d"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Line.sublime-macro"} },
{ "keys": ["f3"], "command": "find_under" },
{ "keys": ["shift+f3"], "command": "find_under_prev" },
{ "keys": ["f9"], "command": "toggle_side_bar" },
{ "keys": ["ctrl+up"], "command": "scroll_lines", "args": {"amount": 5.0 } },
{ "keys": ["ctrl+down"], "command": "scroll_lines", "args": {"amount": -5.0 } },
{ "keys": ["ctrl+alt+d"], "command": "find_under_expand" },
{ "keys": ["ctrl+k", "ctrl+d"], "command": "find_under_expand_skip" },
class StdoutSink(spotify.sink.Sink):
def __init__(self, session):
self._session = session
self.on()
def _on_music_delivery(self, session, audio_format, frames, num_frames):
assert (
audio_format.sample_type == spotify.SampleType.INT16_NATIVE_ENDIAN)
@rodvlopes
rodvlopes / file.js
Created April 30, 2019 01:37
My sublime text settings and key biddings
//Preferences.sublime.settings
{
"folder_exclude_patterns":
[
"node_modules",
".svn",
".git",
".hg",
"CVS"
],
@rodvlopes
rodvlopes / bastter_preco_medio.js
Last active March 22, 2020 22:26
Adiciona o preço médio e ao BastterSystem
/*
Na tela de "Ações", abra o console e cole o snippet abaixo. Depois nevegue pelas movitações.
*/
function injectPrecoMedio() {
$('<th>Cotação</th>').insertAfter('#acaoDatasCompra .itens thead tr th:nth-child(4)')
$('<th>R$ Médio</th>').insertAfter('#acaoDatasCompra .itens thead tr th:nth-child(8)')
$.merge($('#acaoDatasCompra .itens .compra '),$('#acaoDatasCompra .itens .subscrição ')).toArray().forEach(