Skip to content

Instantly share code, notes, and snippets.

View vitorio's full-sized avatar

Vitorio Miliano vitorio

View GitHub Profile
@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 = {}
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 / 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 / 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 / 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()
@vitorio
vitorio / osx-libnfc-homedir.md
Last active August 28, 2016 00:30
Compiling libnfc natively on OS X within your home directory

These instructions compile a native OS X version of libnfc that lives in your home directory, and which cannot be moved around, but should always be discoverable by applications.

Assumes OS X with Xcode or Xcode command-line tools, not macports or homebrew

To install Xcode command-line tools in recent versions of OS X, open Terminal, type xcode-select --install and click "Install"

Older versions of OS X may need to manually download disk images of older versions of Xcode and/or the Xcode command-line tools, as various certificates may have expired (e.g. 10.7.4 requires a manual install from the Xcode 4.6.2 command-line tools image)

Download latest pkg-config (tested with 0.29.1) from https://pkg-config.freedesktop.org/releases/?C=M;O=D

@vitorio
vitorio / osx-libmagic-movable.md
Last active August 28, 2016 17:01
Compiling libmagic and libmagic python bindings natively on OS X for use in any directory

These instructions compile a native OS X version of libmagic and the libmagic python binding which use the system magic database, and adjust their internal paths to allow you to use them from any arbitrary working directory, which is normally restricted in versions of OS X with System Integrity Protection.

Assumes OS X with Xcode or Xcode command-line tools, not macports or homebrew

To install Xcode command-line tools in recent versions of OS X, open Terminal, type xcode-select --install and click "Install"

Older versions of OS X may need to manually download disk images of older versions of Xcode and/or the Xcode command-line tools, as various certificates may have expired (e.g. 10.7.4 requires a manual install from the Xcode 4.6.2 command-line tools image)

Download Apple's latest modified file 5.04 (used in 10.7+) from http://opensource.apple.com/tarballs/file/file-47.tar.gz