Skip to content

Instantly share code, notes, and snippets.

View MichaelAquilina's full-sized avatar
😄
working with python + zsh + rust

Michael Aquilina MichaelAquilina

😄
working with python + zsh + rust
  • London, United Kingdom
View GitHub Profile
#! /bin/bash
if [ -n "$1" ]; then
TARGET="$1"
else
TARGET="."
fi
GREEN="$(tput setaf 2)"
RED="$(tput setaf 1)"
RESET="$(tput sgr0)"
@MichaelAquilina
MichaelAquilina / clean_branches.sh
Last active March 23, 2018 11:20
Automatically clean merged branches in a project
#!/usr/bin/env sh
delete_type="-d"
if [ "$1" = "-D" ];then   
delete_type="-D"
fi
current="$(git rev-parse --abbrev-ref HEAD)"

Keybase proof

I hereby claim:

  • I am michaelaquilina on github.
  • I am michaelaquilina (https://keybase.io/michaelaquilina) on keybase.
  • I have a public key ASAWR3orOCd8nRKqv8wRtQQTavM8Dq8CI2rU7D265WQU2Ao

To claim this, I am signing this object:

#################
# CORE SETTINGS #
#################
#
# Zim settings
#
# Select what modules you would like enabled.
# The second line of modules may depend on options set by modules in the first line.
@MichaelAquilina
MichaelAquilina / vagrant_down.sh
Last active August 29, 2015 14:15
Vagrant Down
# Add this to your .bashrc / .zshrc
function vagrant_down() {
for id in $(vagrant global-status | grep running | awk 'BEGIN {ORS=" "}; {print $1};')
do
vagrant halt "$id"
done
}
@MichaelAquilina
MichaelAquilina / gist:e917d3b494a5a23e31a3
Last active August 29, 2015 14:12
function wrapper to check method performance
# -*- encoding:utf-8 -*-
from __future__ import unicode_literals
import time
import logging
logger = logging.getLogger('performance_timer')
# Simpler wrapper that prints how long the function took to execute
@MichaelAquilina
MichaelAquilina / gist:272f9e6671adfdd2a886
Created August 1, 2014 22:38
Project Pre-Commit hook
echo "Running Nose"
nosetests src/tests
# Diff filter ensure sonly Added, Modified or Changed files are listed (not deleted)
FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -e '\.py$')
echo "Running PEP8 for:"
echo $FILES
# Only run pep8 if files are being committed
if [ -n "$FILES" ]; then
<!DOCTYPE html>
<html class=" ">
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# object: http://ogp.me/ns/object# article: http://ogp.me/ns/article# profile: http://ogp.me/ns/profile#">
<meta charset='utf-8'>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
@MichaelAquilina
MichaelAquilina / GooseExecption
Created August 1, 2014 15:49
Exception while using Goose
---------------------------------------------------------------------------
IOError Traceback (most recent call last)
<ipython-input-10-cea2681e9fda> in <module>()
----> 1 article = goose.extract(raw_html=html_text)
/usr/local/lib/python2.7/dist-packages/goose/__init__.pyc in extract(self, url, raw_html)
54 """
55 cc = CrawlCandidate(self.config, url, raw_html)
---> 56 return self.crawl(cc)
57
@MichaelAquilina
MichaelAquilina / worldcup.py
Created June 25, 2014 16:26
View scores of current games in the Worldcup
#! /usr/bin/python
# View the scores of matches currently in progress
import requests
req = requests.get('http://worldcup.sfg.io/matches')
for match in [m for m in req.json() if m['status'] == 'in progress']:
print match['home_team']['country'], match['home_team']['goals'], 'v', match['away_team']['country'], match['away_team']['goals']