Skip to content

Instantly share code, notes, and snippets.

View pbalduino's full-sized avatar

Plínio Balduino pbalduino

View GitHub Profile
#!/usr/bin/ruby
require 'date'
start = Date.parse("2000-01-17")
(start..Date.today).each do |id|
url = "https://sinfest.xyz/btphp/comics/#{id.to_s}.gif"
puts url
system("wget #{url} -q")
@pbalduino
pbalduino / gist:627254
Created October 14, 2010 23:07
Best debug message
if(freeCluster == NO_FREE_SPACE){
System.out.println("corre negada!");
}
@pbalduino
pbalduino / silvio_santos.rb
Created October 22, 2010 16:31
1, 2, 3, pim! 5, 6, 7, pim!
class Integer
def multiplo_de_quatro?
self % 4 == 0
end
def pim!
multiplo_de_quatro? ? "pim!" : "#{self}"
end
end
@pbalduino
pbalduino / autoblock
Created January 24, 2011 18:03
Script to autoblock break attempts via SSH with UFW
#!/bin/sh
USER=johndoe
echo "[Running: $(date)]" >> /var/log/autoblock.log
grep -a -E -e 'Failed password for' /var/log/auth.log | awk '$9 != "$USER" && $9 != "invalid" {print "ufw deny from "$11}' | sh | grep -vi "skipping" >> /var/log/autoblock.log
grep -a -E -e 'Failed password for invalid' /var/log/auth.log | awk '$11 != "$USER" {print "ufw deny from "$13}' | sh | grep -vi "skipping" >> /var/log/autoblock.log
@pbalduino
pbalduino / gist:1115038
Created July 30, 2011 00:43
Passing a function as parameter to another in Lucio
; first function receives another function and two values
; second function returns the average of two values
(define calculate
(fun
([op v1 v2]
(op v1 v2))))
(define average
(fun
([a b]
@pbalduino
pbalduino / tag_jqmaskmoney.sh
Created August 4, 2011 02:34
Auto tag jQuery MaskMoney plugin
#/bin/bash
# 0.1.0
git checkout 26144646e6f1e2de8876
git tag v0.1.0 -a -m "First version"
# 0.3.0
git checkout 6914f2c8a99a54c6641b
git tag v0.3.0 -a -m "Release 0.3.0"
@pbalduino
pbalduino / wtf
Created August 15, 2011 07:01
este texto estava dentro do meu CSS
aquivemumtextoescritoporalguémseminspiraçãoouvindodirestraitserollingstonesnumferiadodemadrugadaenquantoafamíliadormetranquilasevocêestáusandointernetexplorerparavisualizaressatelasópossodizerquevocêestáperdendoomelhordafestaissoaquinumbrowserdeverdadeficarealmentemuitobonitoesperoquedepoisdeumaboanoitedesonoeucontinueachandoessatelabonitaacontecesério
@pbalduino
pbalduino / gist:1206405
Created September 9, 2011 14:41
CS sample
data = undefined
onLoadContrato = ->
enableStep4()
$('.right_selector').click drawMontante
drawMontante = ->
startDate = $('#contrato_inicio_vigencia').val().split('/')
endDate = $('#contrato_fim_vigencia').val().split('/')
@pbalduino
pbalduino / gist:1206409
Created September 9, 2011 14:42
JS generated by CS
var data, drawMontante, fillData, onLoadContrato, onLoadMontante, readMontanteData, update_tributos;
data = void 0;
onLoadContrato = function() {
enableStep4();
return $('.right_selector').click(drawMontante);
};
drawMontante = function() {
var endDate, endMonth, endYear, params, startDate, startMonth, startYear;
startDate = $('#contrato_inicio_vigencia').val().split('/');
endDate = $('#contrato_fim_vigencia').val().split('/');
} catch (final Exception e) {
// Don't bother reporting this
}