Skip to content

Instantly share code, notes, and snippets.

@amjith
amjith / profile_func.py
Created October 13, 2011 04:22
Profiling decorator
def profile_func(filename=None):
def proffunc(f):
def profiled_func(*args, **kwargs):
import cProfile
import logging
logging.info('Profiling function %s' % (f.__name__))
try:
profiler = cProfile.Profile()
retval = profiler.runcall(f, *args, **kwargs)
profiler.dump_stats(filename or '%s_func.profile' % (f.__name__))
@jkubecki
jkubecki / ExportKindle.js
Last active June 1, 2024 22:51
Amazon Kindle Export
// The following data should be run in the console while viewing the page https://read.amazon.com/
// It will export a CSV file called "download" which can (and should) be renamed with a .csv extension
var db = openDatabase('K4W', '3', 'thedatabase', 1024 * 1024);
getAmazonCsv = function() {
// Set header for CSV export line - change this if you change the fields used
var csvData = "ASIN,Title,Authors,PurchaseDate\n";
db.transaction(function(tx) {
@morja
morja / ExportKindle.js
Last active December 18, 2019 12:13 — forked from jkubecki/ExportKindle.js
Amazon Kindle Export
// The following data should be run in the console while viewing the page https://read.amazon.com/
// It will export a markdown file called "download" which can (and should) be renamed with a .md extension
// modified version of the original script: https://gist.github.com/jkubecki/d61d3e953ed5c8379075b5ddd8a95f22
// this one exludes samples (EBSP), sorts the results by title and exports a list in markdown format
// it also adds links to the amazon pages of the books
var db = openDatabase('K4W', '2', 'thedatabase', 1024 * 1024);
getAmazonMarkdown = function() {
@dlew
dlew / trombonechamp.kt
Created September 24, 2022 14:36
Trombone Champ hacky trombone code
import be.tarsos.dsp.AudioEvent
import be.tarsos.dsp.io.jvm.AudioDispatcherFactory
import be.tarsos.dsp.pitch.PitchDetectionHandler
import be.tarsos.dsp.pitch.PitchDetectionResult
import be.tarsos.dsp.pitch.PitchProcessor
import be.tarsos.dsp.pitch.PitchProcessor.PitchEstimationAlgorithm
import java.awt.Robot
import java.awt.event.InputEvent
import java.util.concurrent.Executors
import java.util.concurrent.TimeUnit