Skip to content

Instantly share code, notes, and snippets.

View astagi's full-sized avatar
💫

Andrea Stagi astagi

💫
View GitHub Profile
@alex
alex / Original lyrics
Created October 1, 2012 04:23
I'm proud to be a unix programmer
If tomorrow all the things were gone,
I’d worked for all my life.
And I had to start again,
with just my children and my wife.
I’d thank my lucky stars,
to be livin here today.
‘ Cause the flag still stands for freedom,
and they can’t take that away.
@nalitzis
nalitzis / gist:2667108
Created May 12, 2012 15:11
Unit test with AsyncTask
public class NetworkTasksTest extends InstrumentationTestCase{
public void testGetMedia() throws Throwable{
final Context context = getInstrumentation().getTargetContext();
final CountDownLatch signal = new CountDownLatch(1);
final NetworkTasks networkTasks = new NetworkTasks(context, new GetMediaListener(signal));
runTestOnUiThread(new Runnable() {
@davidnunez
davidnunez / gist:1404789
Created November 29, 2011 13:20
list all installed packages in android adb shell
pm list packages -f
@hikoz
hikoz / dd.py
Created December 15, 2010 04:45
dd with progress in python
#!/usr/bin/env python
import sys
import time
import signal
from subprocess import Popen, PIPE
dd = Popen(['dd'] + sys.argv[1:], stderr=PIPE)
while dd.poll() is None:
time.sleep(.3)
dd.send_signal(signal.SIGUSR1)
@stefanfoulis
stefanfoulis / gist:715194
Created November 25, 2010 10:39
django-filer: creating Folders and Files programmatically, If-Modified-Since aware download (quick and dirty)
def download_cover(url, name=None):
#print "========================== START"
#print "==== COVER URL: %s" % (url,)
purl = urlparse(url)
path = purl.path
if path.startswith('/'):
path = path[1:]
abspath = os.path.join(settings.MEDIA_ROOT,settings.RADIOPLAYLIST_COVERS_PREFIX,path)
relpath = os.path.join(settings.RADIOPLAYLIST_COVERS_PREFIX,path)
if not os.path.exists(os.path.dirname(abspath)):