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 / the_raven_by_edgar_allan_poe
Created May 2, 2013 18:04
The Raven by Edgar Allan Poe. Because sometimes lorem ipsum is not enough.
Once upon a midnight dreary, while I pondered, weak and weary,
Over many a quaint and curious volume of forgotten lore—
While I nodded, nearly napping, suddenly there came a tapping,
As of some one gently rapping—rapping at my chamber door.
"'Tis some visitor," I muttered, "tapping at my chamber door—
Only this and nothing more."
Ah, distinctly I remember, it was in the bleak December,
And each separate dying ember wrought its ghost upon the floor.
Eagerly I wished the morrow;—vainly I had sought to borrow
From my books surcease of sorrow—sorrow for the lost Lenore—
@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 / gbkrename.py
Created February 18, 2012 16:08
Rename a genbank file to the description of the it's first sequence
#!/usr/bin/env python
import sys
import os
# Biopython libraries or nothing
try:
from Bio import SeqIO
except ImportError:
sys.exit("Biopython library not found. See http://biopython.org for installation instructions.")
@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 / flatten
Last active March 17, 2017 16:49
Examples of non-recursive function to flatten and sort a list. Keeping sorting by the way is greatly better because of timsort on Python.
#!/usr/bin/python
"""
Flatten a list
"""
def flatten(notflat):
flat = []
while notflat:
element = notflat.pop()
if isinstance(element, list):
@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