This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
#-*- coding: utf-8 -*- | |
# Pega nome do filme, do diretor, e a sinopse de uma página do imdb. | |
# Não tem tratamento de erros decente, e provavelmente não vai ter. | |
import sys | |
from bs4 import BeautifulSoup | |
import urllib.request |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for FILE in `ls -1 *.jpg`; | |
do | |
touch -m -d "`exiftool -s3 -CreateDate "$FILE" -dateFormat "%Y-%m-%d %H:%M:%S"`" "$FILE" | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -type d | while read DIR | |
do | |
echo "$DIR" | |
find "$DIR" -maxdepth 1 -type f -exec wc -l {} \; | awk '{loc += $1} END {print loc}' | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
#-*- coding: utf-8 -*- | |
import sys | |
import re | |
import urllib.request | |
from html.parser import HTMLParser | |
def usage(): | |
sys.stderr.write("usage: {0} <url>\n".format(sys.argv[0])) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Implementation of the sieve of Eratostenes. | |
# Calculates all the prime numbers in a range up to the specified limit. | |
import math | |
import sys | |
def process(squareRoot, list): | |
"""This function calculates all the prime numbers in a range (from 2 to the | |
limit you specify). | |
Takes as arguments: | |
squareRoot - the square root of the highest number rounded down |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import math | |
import sys | |
def is_prime(n): | |
""" | |
Tells if a number is a prime | |
This uses the fact that prime numbers greater than 2 and 3 can always | |
be written in the form 6k+1 or 6k-1. That is, they are always 'next' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int ledPin = 13; | |
int fib(int n){ | |
return (n <= 1) ? 1 : (fib(n-1) + fib(n-2)); | |
} | |
void blink(int interval){ | |
digitalWrite(ledPin, HIGH); | |
delay(interval); | |
digitalWrite(ledPin, LOW); |
NewerOlder