Skip to content

Instantly share code, notes, and snippets.

Alessandro Balzano alfateam123

Block or report user

Report or block alfateam123

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@alfateam123
alfateam123 / Just an homemade os.rename
Created Feb 23, 2012
(My first gist! Yeah!) my way to rename files in a repository, using regex and "os" module
View Just an homemade os.rename
import os
import re
for root, dirs, files in os.walk(path):
print root, dirs, files
for filename in files:
if re.match("ex\d+match\d+\.txt", filename):
newname=re.sub(r"ex(?P<numero>\d+)match\d+.txt", r"ex\g<numero>.txt", filename)
print os.path.join(root, filename)
src=open(os.path.join(root, filename))
dst=open(os.path.join(root, newname), "w")
@alfateam123
alfateam123 / [Turing Machine] count of As
Created May 9, 2012
Turing Machine that can count how many A are on a tape made up of As and Bs.
View [Turing Machine] count of As
(0, ab, initCounter, ab, <)
(initCounter, -, searchA, 0, >)
(searchA, a, goCounter, x, <)
(searchA, bx, searchA, xx, >)
(goCounter, x, goCounter, x, <)
(goCounter, 0..9, inc, 0..9, -)
(inc, [0..8-], goX, [1..91], >)
(inc, 9, inc, 0, <)
(goX, 0..9, goX, 0..9, >)
(goX, x, searchA, x, -)
@alfateam123
alfateam123 / Simple Intendation error checker
Created Aug 31, 2012
This is a simple Indentation error checker. It uses "tabnanny" built-in module to check all Python files in a directory.
View Simple Intendation error checker
import tabnanny
from pprint import pprint
PATH="./views"
if __name__=="__main__":
tabnanny.check(PATH)
View released.rb
require 'rss'
require 'open-uri'
##########################################
############ CONFIGURATION ZONE ##########
urls = {
:Omnivium => 'http://www.omnivium.it/feed',
:BFE => 'http://www.nyaa.se/?page=rss&user=195748',
:Aozora => 'http://aozorateam.net/index.php?format=feed&type=rss',
:TaskForce => 'http://task-force.lacumpa.biz/?feed=rss2',
@alfateam123
alfateam123 / tumblrtags.py
Created Jul 2, 2014
Tumblr Tags retriever
View tumblrtags.py
#!/usr/bin/python2
import requests
from HTMLParser import HTMLParser
from collections import Counter
class TumblrParser(HTMLParser):
def __init__(self):
HTMLParser.__init__(self)
self.taglist = list()
@alfateam123
alfateam123 / gist:f4cc5454896f91aa5c53
Last active Aug 29, 2015
waifu material for md2bbc
View gist:f4cc5454896f91aa5c53
Asagi - Anshinin (Medaka Box) - Akane Tsunemori
Banba, Mahiru - Barkhorn, Gerthrud
Charlotte - Chitoge - Chino - Chihiro (kaminomi)
Dora, Stephanie
Eru, Chitanda - Eli Ayase - Erio Touwa
f
g
h
i
j
View gist:caf649f537042ea5a33c
/*
SEE => [SEE, ESE, EES]
http://i.imgur.com/YQYwjFD.jpg
*/
def add_letters(*combo_tree tree IN, letter_counter dict IN)
for letter in letter_counter.keys() do
if letter_counter[letter] > 0 then
combo_tree.add_child(letter)
letter_counter[letter] -= 1 //so che, nella ricorsione, ho una istanza in meno della stessa lettera a disposizione
@alfateam123
alfateam123 / r9k2irc.py
Created Dec 9, 2014
/r9k/ to irc. markov bots, maybe? Use a very large n.
View r9k2irc.py
#!/usr/bin/env python
import moesearch as foolz
import argparse
parser = argparse.ArgumentParser("r9k to irc!")
parser.add_argument("pages", type=int, help="how many pages you want to download")
def retrieve_pages(pages=1):
for page in range(pages):
View test_grammatica_strana.py
from __future__ import print_function
import re
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("n")
def generate_grammar(n):
dat_grammar = "(ab)?"
for i in range(1, n):
@alfateam123
alfateam123 / onlysomefields.py
Created Mar 18, 2015
a little scripts for extracting only some fields from a csv.
View onlysomefields.py
import csv
import sys
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("fname")
LIST_OF_FIELDS = [
"pippo",
"pluto",
You can’t perform that action at this time.