Skip to content

Instantly share code, notes, and snippets.

View silveira's full-sized avatar

Silveira Neto silveira

View GitHub Profile

twitter.com/settings/muted_keywords

Rafa Kalimann
Prova do líder
BBB21
paredão
BBB
BBB 22
BBB 21
Big brother
@silveira
silveira / 2021_bbb_twitter_muted_words.md
Created February 7, 2021 16:29
2021 BBB Twitter Muted Word
@silveira
silveira / rename_sailor_moon.py
Created July 28, 2019 19:50
Renaming a bunch of sailor moon episodes so PLEX can understand them
import glob, os
os.chdir("E:\Anime\Seriados\Sailor Moon")
offset = 46
for file in glob.glob("*.mkv"):
if (file.find("Sailor_Moon_R")!=-1):
pieces = file.split("_")
old_number = int(pieces[6])
new_number = old_number + offset
@silveira
silveira / gist:99ea1ef203dde9d56cda0680fd8939c4
Last active July 17, 2018 16:29
All english words where you can replace 'AS' for '45'
# cat /usr/share/dict/words | grep -i as | tr a-z A-Z |sed -e 's/AS/45/g'
AB45
AB45E
AB45ED
AB45EDLY
AB45EDNESS
AB45EMENT
AB45ER
AB45GI
@silveira
silveira / primeproduct.js
Last active January 31, 2018 16:37
f receives a lower case string word and returns a product of primes that is the same for anagrams of that word
// https://twitter.com/fermatslibrary/status/958700402647674880
function f(word) {
var primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71,73, 79, 83, 89, 97, 101];
var product = 1;
for (var i=0; i<word.length; i++) {
product *= primes[word[i].charCodeAt(0)-97];
}
return product;
}
@silveira
silveira / cdecfe.rb
Created November 20, 2017 17:51
a simple synth loop for Sonic Pi
use_synth :pulse
notes = [:C,:D,:E,:C,:F,:E]
live_loop :x do
with_fx :wobble do
for note in notes
play note
sleep 0.5
end
@silveira
silveira / marina_lgbt.diff
Created August 30, 2014 22:53
Marina_LGBT.diff
1c1
< * Apoiar propostas em defesa do casamento civil igualitário, com vistas à aprovação dos projetos de lei e da emenda constitucional em tramitação, que garantem o direito do casamento igualitário na Constituição e no Código Civil.
---
> * Garantir os direitos oriundos da união civil entre pessoas do mesmo sexo.
3c3
< * Articular no Legislativo a votação do PLC 122/06, que equipara a discriminação baseada na orientação sexual e na identidade de gênero àquelas já previstas em lei para quem discrimina em razão de cor, etnia, nacionalidade e religião.
---
> * Aprovado no Congresso Nacional o Projeto de Lei da Identidade de Gênero Brasileira – conhecida como a Lei João W. Nery – que regulamenta o direito ao reconhecimento da identidade de gênero das “pessoas trans”, com base no modo como se sentem e veem, dispensar a morosa autorização judicial, os laudos médicos e psicológicos, as cirurgias e as hormonioterapias.
5,7c5
< * Comprometer-se com a aprovação do Projeto de Lei da Identidade de Gênero Brasileira - c
@silveira
silveira / rho.py
Created April 22, 2014 17:33
Pollard’s rho algorithm for factoring integers
def gcd(a, b):
while b:
a, b = b, a%b
return a
def f(x,n):
return (x*x-1)%n
def rho(n):
x = 2
@silveira
silveira / locktest
Created December 17, 2013 16:06
why the objlock doesn't work? (i.e. it should count to 10000)
import time
import threading
class objnolock(object):
def __init__(self,c):
self.c=c
def inc(self):
new = self.c+1
time.sleep(0.001)
self.c = new
@silveira
silveira / factors
Created August 13, 2013 02:16
factors between 1 and 1000
def factors(n):
return set(reduce(list.__add__,
([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0)))
# from http://stackoverflow.com/questions/6800193/what-is-the-most-efficient-way-of-finding-all-the-factors-of-a-number-in-python
for i in xrange(1,1001):
print str(i).zfill(4), '*' * len(factors(i))
"""
output: