Skip to content

Instantly share code, notes, and snippets.

@jsoffer
jsoffer / mixmusic.sh
Last active December 24, 2015 10:49
Mezcla una canción consigo misma
# lame --decode song.mp3 song.wav
WAV=$1
OFFSET=$2
# podría integrar los cambios en un solo comando,
# sin usar archivos intermedios, con 'delay'
# 'remix' hace el equivalente de 'pan', el canal
# derecho aparece antes al hacer offset
@jsoffer
jsoffer / gsearch.js
Last active December 25, 2015 11:38
Filtro para resultados de Google Search (que no use reescritura del url, etc)
/* Uso: 'node gsearch.js'; en el navegador, 'http://localhost:8000/?q=la búsqueda' */
var http = require('http')
, url = require('url')
, google = require('google-tools')
, mu = require('mu2');
mu.root = __dirname + '/templates';
http.createServer(function (req, web_out) {
@jsoffer
jsoffer / freebsd_ports.py
Created October 16, 2013 16:10
Crea de manera ingenua una gráfica .dot que contiene las dependencias de los ports instalados en un sistema FreeBSD (9.1, requiere 'pkg' estilo pkgng)
from subprocess import check_output
data = check_output(["pkg", "info", "-a", "-d"])
fuente = ''
print "digraph Dependencias {"
for linea in data.split('\n'):
if linea:
@jsoffer
jsoffer / browser.py
Last active December 26, 2015 08:49
Mini-navegador homebrew. Construído porque Opera está funcionando mal (por ejemplo, no guarda el buscador http://localhost:8000, que es un servicio interno, por default). Webkit. Mucha flexibilidad, pocas funciones.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
A minimal web browser.
Original: http://ralsina.me/weblog/posts/BB948.html
Features:
+++ verificar no tráfico no solicitado (startup, al menos)
@jsoffer
jsoffer / browser.py
Last active December 26, 2015 13:49
Navegador mínimo en Python y Webkit, toma 2. Incluye tabs. Basado en foobrowser (https://code.google.com/p/foobrowser/)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
minimalistic browser levering off of Python, PyQt and Webkit
Original: https://code.google.com/p/foobrowser/
[email protected]
+ tabs
@jsoffer
jsoffer / pkg_graph.py
Created December 5, 2013 18:45
Plots the reverse dependences of a FreeBSD package, cleaned up to remove redundant edges
import subprocess
import networkx as nx
import matplotlib.pyplot as plt
from sys import argv
root = argv[1]
G = nx.DiGraph()
@jsoffer
jsoffer / simplereader.c
Created February 28, 2016 12:09
libdwarf example
/*
Copyright (c) 2009, David Anderson; 2016, Jaime Soffer.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the