Skip to content

Instantly share code, notes, and snippets.

View vitorio's full-sized avatar

Vitorio Miliano vitorio

View GitHub Profile
Zhook: Zip + HTML + Book.
DRAFT SPECIFICATION
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in RFC 2119.
Software that displays a Zhook file is here called a Reading System (RS).
@vitorio
vitorio / gist:7368467
Created November 8, 2013 09:18
JSMESS audio notes
9:00 PM <•SketchCow> #define SDL_XFER_SAMPLES (512)
9:01 PM <•Vito`> right
9:02 PM <•Vito`> and now set that library_sdl.js line to allow 512
9:03 PM ⇐ BlueMaxim quit (~guy@ppp59-167-136-105.static.internode.on.net) Ping timeout: 265 seconds
9:03 PM <•SketchCow> if (SDL.audio.samples < 512 || SDL.audio.samples > 524288 /* arbitrary cap */) {
9:03 PM <•SketchCow> So, just as trivia
9:04 PM <•SketchCow> I do see some 1024 settings in that file
9:04 PM <•SketchCow> So this might break shit
9:04 PM <•SketchCow> But I agree, set to 512
9:04 PM <•SketchCow> Make 1024 if needed
4:55 AM <Lindrian> guys
4:55 AM <Lindrian> anyone, please?
4:55 AM <Lindrian> Ive been asking for help for days >.<
5:19 AM <Lindrian> clb: do you have any idea??
5:20 AM <clb> Lindrian: sorry, no
5:20 AM <Lindrian> clb: if you happen to catch someone who does, could you ask them for me?
5:21 AM <Lindrian> you probably know more people using emscripten than i do
5:22 AM <clb> Lindrian: I've seen you asking for help for weeks now, I think you need to have the capability to research the problem field yourself and learn the required knowledge if there is nobody else that is familiar with the issue
5:23 AM <Lindrian> i have been searching extensively
5:23 AM <Lindrian> i have asked countless people
@vitorio
vitorio / gist:7702384
Last active December 29, 2015 17:09
Using the makefile debugger remake to figure out a JSMESS/MESS build conflict
remake[1]: *** [obj/sdl/mess/mess.o] Error 1
#0 obj/sdl/mess/mess.o at ??
#1 messtiny at /home/milianov/remess/jsmess/mess/makefile:869
#2 emulator at /home/milianov/remess/jsmess/mess/makefile:812
#3 default at /home/milianov/remess/jsmess/mess/makefile:764
***Entering debugger because we encountered a fatal error.
***Exiting the debugger will exit make with exit code 1.
@vitorio
vitorio / distance-epub-01.py
Last active August 29, 2015 14:03
Turn a Distance ePub file into something more web-appropriate: replace the XHTML doctype with HTML5; inline zeitgeist.css, template.css, and some CSS from your.distance.cc to move the paragraph numbers; add IDs; protect the email address with JS; and resolve and embiggen the dsn.tc short URLs. Deeded to the public domain. To the extent possible …
# coding=utf-8
__author__ = 'vitorio'
import bs4
import argparse
import re
import requests
parser = argparse.ArgumentParser(description='Turn a Distance ePub file into something more web-appropriate')
parser.add_argument('epubfile', help='The Distance ePub file to read from')
@vitorio
vitorio / microsoft-store.lua
Last active August 29, 2015 14:12 — forked from mbmccormick/microsoft-store.lua
One-time check for Microsoft Store stock
local sku = '309986300'
local zipcode = '10001'
local response = http.request {
url = 'https://rtgliveservices.cloudapp.net/Location/LocationService.svc/NearestSites?zipcode=' .. zipcode .. '&maxRadius=100'
}
local data = json.parse(response.content)
local sites = {}
@vitorio
vitorio / mbox-unique-email-addresses.py
Created March 30, 2015 01:17
So, let's say you have an mbox full of mail and you want to get all the To: addresses out of it. And let's say you've seen a bunch of intimidating complicated examples like http://stackoverflow.com/questions/7166922/extracting-the-body-of-an-email-from-mbox-file-decoding-it-to-plain-text-regard or http://nbviewer.ipython.org/github/furukama/Mini…
# via http://stackoverflow.com/questions/14903664/determine-unique-from-email-addresses-in-maildir-folder
import mailbox
import email
mbox = mailbox.mbox('DADEOL/AOL Mail sorted/Saved.DADEOL Sent.mbox')
uniq_emails = set(email.utils.parseaddr(msg['to'])[1].lower() for msg in mbox)
for a in uniq_emails:
@vitorio
vitorio / testmess.js
Created November 23, 2015 00:12
PhantomJS 2 testing
var page = require('webpage').create(),
system = require('system'),
t, address;
page.onConsoleMessage = function(msg) {
console.log(msg);
};
if (system.args.length === 1) {
console.log('Usage: testmess.js <some URL>');
@vitorio
vitorio / findexifdates.py
Created December 11, 2015 21:56
Flickr API: find and fix "taken on" dates
#CC0 public domain dedication
#Find all the EXIF fields with the letters "date" and output them and their content
import flickrapi
api_key = u''
api_secret = u''
my_photoset = u''
my_user_id = u''
@vitorio
vitorio / 01.py
Created February 1, 2016 04:59
(2011) wget + moz-headless-screenshot to take screenshots of archived URLs
# Assumptions:
# moz-headless-screenshot in ./bin
# wget 1.12 in system path
# Ubuntu 10.10 defaults to Python 2.6.6 so we provide 2.7's subprocess module ourselves
# I guess we could also install 2.7
import optparse, urlparse, tempfile, subprocess271 as subprocess, os.path
parser = optparse.OptionParser()
options, args = parser.parse_args()