Skip to content

Instantly share code, notes, and snippets.

@danicuki
danicuki / proxy_gets.rb
Created March 18, 2011 01:15
Use many HTTP proxies to get pages on the web. Util for increasing count hits
require 'rubygems'
require 'restclient'
require 'nokogiri'
require 'json'
def call_url(url)
Thread.new do
puts "Chamando url #{url} no proxy #{RestClient.proxy}"
RestClient.get(url) rescue nil
end
@danicuki
danicuki / google_mail_to_lw_emailmkt.rb
Created March 18, 2011 01:17
imports google contacts to locaweb email marketing account
EMAIL_MKT_CHAVE = "[SUA_CHAVE]"
GOOGLE_EMAIL = "[SEU EMAIL NO GOOGLE]"
GOOGLE_PASSWD = "[SENHA GOOGLE]"
EMAIL_MKT_HOST = "[MAQUINA EMAIL MKT]"
EMAIL_MKT_LISTS = "11115"
EMAIL_MKT_LOGIN = "[LOGIN EMAIL MKT]"
EMAIL_MKT_URL = "http://#{EMAIL_MKT_HOST}.locaweb.com.br/admin/api/#{EMAIL_MKT_LOGIN}/contatos/importacao/?chave=#{EMAIL_MKT_CHAVE}&listas=#{EMAIL_MKT_LISTS}"
login = {:accountType => "HOSTED_OR_GOOGLE",
:Email => GOOGLE_EMAIL,
@danicuki
danicuki / scheme-study1.ss
Created May 8, 2011 00:11
Interpretador Rudimentar
;More information about what this program do at
;http://www.cs.brown.edu/courses/cs173/2008/Assignments/01-rinterp.html
#lang plai
; Binding type definition
(define-type Binding
[binding (name symbol?) (named-expr WAE?)])
@danicuki
danicuki / polinomio.erl
Created November 30, 2011 01:55
Polynomio em Erlang
-module(polinomio).
-include_lib("eunit/include/eunit.hrl").
-import(string, [concat/2]).
polinomio(C,E) -> [{C,E}].
soma(L,[]) -> L;
soma([],L) -> L;
soma([{C1,E}|T1], [{C2,E}|T2]) -> [{C1 + C2, E}|soma(T1,T2)];
soma([{C1,E1}|T1], [{C2,E2}|T2]) ->
package pfc
private case class Term(coef: Double, exp: Int) {
require(coef != 0 && exp >= 0)
}
object Pol {
// conversao implicita de Double em Pol
implicit def doubleToPol(d: Double): Pol = Pol(d, 0)
@danicuki
danicuki / bash_helper.sh
Created March 9, 2012 14:18
Usefull bash commands
#count sources in a tomcat.log access file
head -n 2000000 localhost_access_log.2012-03-09.log | cut -f1 -d" " | sort | uniq -c | sort -k2nr | awk '{printf("%s %s \n",$1,$2)}END{print}' |sort -n
@danicuki
danicuki / columnstore-remove.sh
Created May 30, 2017 14:06
Mariadb Columnstore - remove PM steps
# example, removing pm3, moving its dbroot to pm1
# using google cloud
# run commands on pm1 server
ma stopsystem y
ma movePMDbrootConfig pm3 3 pm1
ma removeModule pm3
# now we shut down and destroy the removed module server, and attach its data disk to pm1 server
#Example of how to completly remove a pm server and its dbroot
# pm server being removed: pm4
# dbroot being removed: 4
ma redistributeData start remove 4
ma stopSystem y
ma unassignDBRootPMConfig 4 pm4
ma removeModule pm4 y
ma startSystem
ma removeDBRoot 4
# bash
mkdir nova-pasta
npm init
npm install --save sequelize
npm install --save sequelize-cli
npm install --save sqlite3
npm install --save mysql2
@danicuki
danicuki / Cretificado.md
Last active May 26, 2020 14:33
Update GCP Certificate using Lets Encrypt

Setup

mkdir -p certbot/certificates
mkdir certbot/logs
cd certbot

Novo Certificado

docker pull certbot/certbot && docker run --rm -it --name certbot \