This file contains 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
ffmpeg -t 10 -ss 00:00:08 -i video.mp4 -loop 0 -vf "transpose=1" -s 240x320 output.gif | |
convert -layers Optimize output.gif output-small.gif | |
ffmpeg -t 10 -ss 00:00:10 -i video2.mp4 -loop 0 -s 320x240 output2.gif | |
convert -layers Optimize output2.gif output2-small.gif |
This file contains 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
cat ~/.ssh/id_rsa.pub | ssh root@your.ip.address "cat >> ~/.ssh/authorized_keys" |
This file contains 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
class ChoicesEnum(object): | |
@classmethod | |
def choices(cls): | |
descriptions = cls.get_descriptions() | |
keys = descriptions.keys() | |
attrs = cls.get_atributes(keys) | |
return tuple([(attrs[k], descriptions[k]) for k in keys]) | |
@classmethod |
This file contains 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
from bs4 import BeautifulSoup | |
import urllib2 | |
import re | |
class Anime2MP4(object): | |
anime_zero_url = 'http://www.animesproject.com.br/serie/885/2162/Death-Parade-Episodio-00' # noqa | |
anime_url_format = 'http://www.animesproject.com.br/playerv52/player.php?a=0&0={0}&1={1}' # noqa | |
def build_episode_url(self, url_parameters): |
This file contains 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
# -*- coding: utf-8 -*- | |
""" | |
Hidroweb | |
http://hidroweb.ana.gov.br/ | |
Algumas bibliotecas terceiras deverão ser instaladas. | |
pip install requests | |
pip install beautifulsoup4 |
This file contains 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
from itertools import permutations | |
from itertools import combinations | |
from itertools import combinations_with_replacement |
This file contains 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
from boto.s3.connection import S3Connection | |
from boto.s3.key import Key | |
# Get connection using Amazon secret and access keys | |
conn = S3Connection('<aws secret key>', '<aws access key>') | |
# Get the bucket with name 'bucketname' | |
bucket = conn.get_bucket('bucketname') | |
# Get the key reference to file 'picture.jpg' |
This file contains 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
# -*- coding: utf-8 -*- | |
from django.conf import settings | |
from django.http import JsonResponse | |
from hashlib import sha1 | |
import base64 | |
import hmac | |
import time | |
import urllib |
This file contains 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
pip install youtube-dl | |
youtube-dl --username xxxxxxxx --password xxxxxxxx --twofactor XXXXXX "https://www.youtube.com/watch?v=xxxxxxx" |
This file contains 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
# unicode => human readable format | |
uni_text = u'café' | |
print type(uni_text) | |
print isinstance(uni_text, str) | |
print len(uni_text) | |
uni_str_convert = uni_text.encode('UTF-8') | |
# str => bytes | |
str_text = 'café' |