Skip to content

Instantly share code, notes, and snippets.

View astagi's full-sized avatar
💫

Andrea Stagi astagi

💫
View GitHub Profile
@astagi
astagi / compile
Created October 12, 2011 22:14
Just a simple experimental way to embed python in Vala
valac python.vapi pyembtest.vala -X -I. -X -I/usr/include/python2.6 -X -lpython2.6 -o pyembtest
@astagi
astagi / testisgd.py
Created January 7, 2012 01:29
IS.GD Shorty-Python test for Turpial
import shorty
url = 'http://google.com'
short_service = shorty.Isgd()
st = short_service.shrink(url)
print st
@astagi
astagi / baby_rocker.sh
Created June 27, 2012 16:25
Baby Rocker by Arul John
#!/bin/sh
#Funny script by Arul John
#Visit http://aruljohn.com/notes/babyrocker.html
while [1 = 1] do
#eject cdrom
eject
@astagi
astagi / README
Created August 5, 2012 14:04
Android scripts for developing Android apps under Linux without using Eclipse
1. Install Apache Ant (http://ant.apache.org/)
2. Download the Android SDK from http://developer.android.com/sdk/index.html if you don't have it yet
3. Extract the package somewhere (I placed it in my home directory /home/andrea/android-sdk-linux_x86)
4. Set ANDROID_SDK environment variable with the path where you placed the SDK folder
5. Run buildall.sh to build the .apk
6. Run run.sh to launch Turpial on your device
7. In case you need to restart adb, run restartadb.sh
@astagi
astagi / pulcinopyo.py
Created August 17, 2012 18:36
PulcinoPyo: Python script for generating "Pulcino Pio" style (??) songs!
#!/usr/bin/env python
# -*- coding: latin-1 -*-
# PulcinoPyo: generate a "Pulcino Pio" style (??) song!
# Author: Andrea Stagi on vacation <stagi.andrea@gmail.com>
# License: c'mon default header, don't be silly :D
#Our type Animal
class Animal:
@astagi
astagi / RPN.py
Created August 30, 2012 10:26
RPN calculation using Python
import re
def RPN(operation):
s = []
for el in operation.split(" "):
if el.isdigit():
s.append(el)
elif re.match("[+,-,*,/]", el) and len(s) > 1:
s.append(eval("%s %s %s" % ( s.pop(), el , s.pop() )))
else:
@astagi
astagi / rot.py
Created September 13, 2012 20:49
Encode and decode letters and numbers using ROT13 and ROT5
#!/usr/bin/env python
# ROT: encode and decode letters and numbers using ROT13 and ROT5
# Author: Andrea Stagi <stagi.andrea@gmail.com>
# License: c'mon default header, don't be silly :D
def rot_encode(clr_str):
rot_chars = []
@astagi
astagi / SplashScreenActivity.java
Created February 6, 2013 15:06
Extend this class to transofrm your activity in a splash screen activity for Android!
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
public class SplashScreenActivity extends Activity {
private Handler splashTimeout = new Handler();
private Class<?> cls;
private long time;
@astagi
astagi / build.sh
Created September 13, 2013 20:47
Just a simple script to build your Pebble app and launch the deploy server
#!/bin/sh
./waf build
python -m SimpleHTTPServer 8000
@astagi
astagi / centerresize
Created December 23, 2013 17:16
Resize images 200x200 centered
im.resize({
srcPath: src ,
dstPath: dst,
width: 200,
height: "200^",
customArgs: [
"-gravity", "center",
"-extent", "200x200"
]
}, function(err, stdout, stderr) {