Skip to content

Instantly share code, notes, and snippets.

@puntonim
puntonim / _randomize.py
Last active October 20, 2025 13:03
Randomize songs order
#!/usr/local/bin/python3
"""
GOAL: randomize the order of songs in this dir, as played by AGPTEK A26.
Note: the order is not determined by file names!!
The player AGPTEK A26 plays songs following the FAT directory entry order,
like many basic devices do.
Which basically is the timestamp a file was added to the dir:
https://superuser.com/a/1348720
@puntonim
puntonim / py-tunnel1.py
Last active January 30, 2016 18:37
SSH tunnel in Python
# Create an SSH tunnel in Python.
# In this example we suppose we are in a firewalled network where we cannot
# access GMAIL IMAP server on port 993.
# So we create a tunnel to a machine out of the firewalled network and forward
# to GMAIL IMAP server.
#
# Requirements:
# pip install paramiko
#
# Inspired by:
class ScraperManager:
def __init__(self):
self.scraper = ThisIsTheScraperYouWroteWithScrapy()
def start_session(self):
# Loop over all elements that Scrapy finds.
for files, metadata in self.scraper.run():
# `files`: a list of URLs of actual files to download for the current paper, like:
# ['http://www.narcis.com/paper1-part1.pdf', 'http://www.narcis.com/paper1-part2.pdf']
# `metadata`: a dictionary of metadata for the current paper, like:
@puntonim
puntonim / bookie-macosx-setup.md
Created March 24, 2014 18:57
Bookie: setup a Mac OSX local dev environment

Bookie: setup a Mac OSX local dev environment

I succesfully managed to setup a local development environment for Bookie in my Mac OSX machine and I'd like to share a few notes. The required changes are just small details and I guess it would be easy to edit the Makefile in order to make it work with Mac OSX, but actually I'm not an expert on it...

System configuration

OS: Mac OSX 10.8.5
Xcode: 4.6.3

Steps

  1. Manually install system libraries