Skip to content

Instantly share code, notes, and snippets.

View 0asa's full-sized avatar
🐽

Vincent Botta 0asa

🐽
View GitHub Profile
@0asa
0asa / gitall.py
Created January 27, 2015 11:08
(naively) `git pull` all repositories found in the current directory.
import os, glob
folders = glob.glob('*')
for folder in folders:
if folder != 'gitall.py':
print ''
print "===="*5 + " " + folder + " " + "===="*5
os.chdir(folder)
os.system('git pull') # or whatever commands...
from pyspark import SparkContext
import numpy as np
from sklearn.cross_validation import train_test_split, Bootstrap
from sklearn.datasets import make_classification
from sklearn.metrics import accuracy_score
from sklearn.tree import DecisionTreeClassifier
def run(sc):
curl -s https://api.github.com/orgs/twitter/repos?per_page=200 | ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each { |repo| %x[git clone #{repo["ssh_url"]} ]}'
@0asa
0asa / colorize.py
Last active August 29, 2015 14:07
(brutally) Add color to a given text according to 'sentiment analysis' with Pattern (http://www.clips.ua.ac.be/pattern).
from pattern.en import sentiment
import colors
items = sentiment.viewitems()
# some text
text = ("Then, the module's variables, functions, and classes will be available to the caller through "
"the module’s namespace, a central concept in programming that is particularly helpful and "
"powerful in Python. Thanks to the way imports and modules are handled in Python, it is "
"relatively easy to structure a Python project. Easy, here, means that you do not have many "
@0asa
0asa / pushbullet.py
Last active August 29, 2015 14:02
Pushbullet notification
import requests
API_KEY = 'API_KEY'
IDEN = 'DEVICE_ID'
# get the list of available devices
resp = requests.get('https://api.pushbullet.com/v2/devices',auth=(API_KEY,''))
print resp.json()
data = {