Skip to content

Instantly share code, notes, and snippets.

View ihercowitz's full-sized avatar

Igor Hercowitz ihercowitz

View GitHub Profile
@ihercowitz
ihercowitz / YT-dlbatch.py
Created April 10, 2014 12:33
A batch downloader for youtube-dl
import requests
from lxml.html import fromstring
import os
search='https://www.youtube.com/results'
def make_my_day(query):
page = requests.get(search, params=[{'search_query', str(query)}])
links = fromstring(page.text).cssselect('a')
@ihercowitz
ihercowitz / DisneyPhotoPassDwn.py
Created May 12, 2014 00:59
downloading the disney photopass files like a boss (for free)
import requests
import shutil
from lxml.html import fromstring
DPP='http://www.disneyphotopass.com'
html = fromstring(open('photopassinfos.html', 'r').read())
imgs = html.cssselect('img')
for index, img in enumerate(imgs):
tmp = img.get('src').replace('=36', '=3096').replace('=70', '=300') + '&aspectRatio=EightByTen'
@ihercowitz
ihercowitz / utils.clj
Created August 22, 2014 01:00
clojure function call function runtime
(ns test-macro.utils)
(defn test-me []
(str "Test me"))
(defn test-you []
(str "Test you"))
(defn run-me [fn]
(eval (read-string (str "(test-macro.utils/test-" fn ")"))))
@ihercowitz
ihercowitz / rainbownize.clj
Created September 18, 2014 19:23
A color festival for your texts. Maybe this could be used on LOG FIles
(defonce color-map (range 255))
(defn rand-color [max]
(nth color-map (rand-int max)))
(defn rainbownize [& text]
(->> (clojure.string/join #" " text)
seq
(map #(str "\033[38;5;" (rand-color 254) "m" % "\033[0m"))
(apply str)))
@ihercowitz
ihercowitz / batchmagnet.py
Created February 28, 2015 01:41
A simple script to batch download series from KickassTorrents
# -*- coding: utf-8 -*-
import requests
from lxml.html import fromstring
import os
kickass = "https://kickass.to/usearch/{0}/"
magnet=lambda link, local: os.system('aria2c --conf-path=$HOME/.aria2c.torrent --max-download-limit=1100K --max-upload-limit=15K --listen-port=63654 "' + link + '" -d '+ local +' --seed-time=1')
localFolder="~/Vídeos/Seriados/Gotham"
@ihercowitz
ihercowitz / PBMagnet.py
Last active August 29, 2015 14:19
Script to download series on kickassTorrents, using Aria
# -*- coding: utf-8 -*-
import requests
from lxml.html import fromstring
import os, sys
piratebay = "https://thepiratebay.se/search/{0}/0/99/0"
kickass = "https://kickass.to/usearch/{0}/"
magnet=lambda link, local: os.system('aria2c --conf-path=$HOME/.aria2c.torrent --max-download-limit=1100K --max-upload-limit=15K --listen-port=63654 "' + link + '" -d '+ local +' --seed-time=1')
@ihercowitz
ihercowitz / core.clj
Created April 28, 2015 16:33
A mastermind board game (http://en.m.wikipedia.org/wiki/Mastermind_(board_game)) implementation in clojure...
(ns mastermind.core
(:gen-class))
(defn generate-numbers []
(let [game [1 2 3 4 5 6]]
(->> game shuffle (take 4) vec)))
(defn guess [user answer]
(map #(= %1 %2) user answer))
@ihercowitz
ihercowitz / VisaVale.py
Created October 28, 2010 13:19
Script para obter o saldo do Visa Vale
import urllib2, urllib, sys
from BeautifulSoup import BeautifulSoup
import re
class VisaVale():
def get_visavale_informations(self,visa):
url = 'http://www.cbss.com.br/inst/convivencia/SaldoExtrato.jsp'
data = urllib.urlencode([('numeroCartao',visa),('primeiroAcesso','S')])
request = urllib2.Request(url)
import sys
def prime(number):
n = abs(number)
if n < 1:
return False
if n==2:
return True
@ihercowitz
ihercowitz / goldbach.lisp
Created January 9, 2012 17:32
Demonstrates the Goldbach's conjecture - Every even integer greater than 2 can be expressed as the sum of two primes
;*******************************************************************************************************************
;Demonstrates the Goldbach's conjecture - Every even integer greater than 2 can be expressed as the sum of two primes
;
;Author: Igor Hercowitz
;
;usage: clisp goldbach.lisp <number>
;output: the sum of the primes list
;
;Ex:
;> clisp goldbach.lisp 100