Skip to content

Instantly share code, notes, and snippets.

View andersonberg's full-sized avatar

Anderson Berg andersonberg

View GitHub Profile
import urllib.request
import json
resp = urllib.request.urlopen('http://worldcup.sfg.io/matches').read()
for jogo in json.loads(resp.decode('utf-8')):
if jogo['status'] == 'completed':
print (jogo['home_team']['country'], jogo['home_team']['goals'], 'x', jogo['away_team']['country'], jogo['away_team']['goals'])
import paramiko
ssh = paramiko.SSHClient()
ssh.connect('127.0.0.1', username='anderson', password='123')
import paramiko
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('127.0.0.1', username='anderson', password='123')
stdin, stdout, stderr = ssh.exec_command('ls\n')
print stdout.readlines()
ssh.close()
stdin, stdout, stderr = ssh.exec_command('sudo fdisk -l\n')
stdin.write('1234\n')
stdin.flush()
print stdout.readlines()
import twitter
api = twitter.Api()
tweets = api.GetPublicTimeline()
for tweet in tweets:
print tweet.text
user_tweets = api.GetUserTimeline('user')
for tweet in user_tweets:
print tweet.text
user_tweets = []
tweets = api.GetUserTimeline(user, count=30)
for tweet in tweets:
user_tweets.append(tweet.text.encode('utf-8') + '\n')
print user_tweets