Skip to content

Instantly share code, notes, and snippets.

@carolosf
carolosf / midi.sh
Created February 24, 2018 18:17
Nice mappings for FL Studio 12 and my M-Audio Axiom air 32 mini
#!/bin/bash
# Nice mappings for FL Studio 12 and my M-Audio Axiom air 32 mini
# aseqdump -l
# aseqdump -p "Axiom A.I.R. Mini32"
# sudo apt install xdotool
aseqdump -p "Axiom A.I.R. Mini32" | \
while IFS=" ," read src ev1 ev2 ch label1 data1 label2 data2 rest; do
#echo "$srsc $ev1 $ev2 $ch $label1 $data1 $label2 $data2 $rest"
case "$ev1 $ev2 $data1 $data2" in
"Control change 17 127" ) xdotool key space ;;
@ThisIsOstad
ThisIsOstad / Chrome 61 Backup Saved Passwords
Last active September 12, 2020 18:00
As Chrome removed the "Backup" button in "Saved Passwords", you can make a backup from your passwords by running this code in the console!
// 1. Open chrome://settings/passwords
// 2. Open chrome developer tools (using F12 or Ctrl+Shift+i)
// 3. Run the following code in the console tab
// 4. Copy output in a text file and save it somewhere safe!
function asyncForEach(array, done, iterator) {
var i = 0;
next();
function next(err) {
if (err) {
var p = new Promise( function(resolve,reject){
resolve(374);
});
p.then(function fulfilled(message){
foo.bar();
console.log(message); // never reached
},
function rejected(err){
// never reached
@paralysedforce
paralysedforce / .vimrc
Created August 8, 2017 02:05
My vimrc
"Vundle Setup
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'christoomey/vim-tmux-navigator'
call vundle#end()
filetype plugin indent on
set autoread
"""""""""""""""""""""
anonymous
anonymous / REAPER_Commandline_Notes.md
Created June 21, 2017 18:20
REAPER Commandline Reference Notes

REAPER Commandline Reference Notes

Since there is not much documentation on this yet, here are some notes:

batchconvert

OS/X HINT: use absolute filenames for input, otherwise the project file will be found but not the referenced files

Fileformat:

In a recent discussion I had with a friend about Haskell and Scala, they brought up the fact that they sometimes miss Scala's partial functions. In Scala, these are a trait of their own somewhat different from what Haskellers usually understand by "partial function". In particular, you can check if a value is in the domain of the partial function before applying it to the function.

Interestingly enough, partial functions are also supported in Haskell - they just happen to be hidden away in some more obscure parts of the base library. What follows is my attempt to make a module that brings this functionality out and makes it more accessible. Since this is meant to be a literate Haskell source, let's start with some preamble.

{-# LANGUAGE TypeOperators, NoImplicitPrelude, GeneralizedNewtypeDeriving #-}

module Data.Function.Partial where

import Prelude hiding (id, (.), ($))
@shitpoet
shitpoet / haml.lua
Created April 7, 2017 19:34
basic HAML lexer for TextAdept
-- Copyright 2006-2015 Mitchell mitchell.att.foicica.com. See LICENSE.
-- HAML LPeg lexer.
local l = require('lexer')
local token, word_match = l.token, l.word_match
local P, R, S, V = lpeg.P, lpeg.R, lpeg.S, lpeg.V
local M = {_NAME = 'haml'}
-- Whitespace.
# DATA PROVIDED TO US. STRUCTURE CANNOT BE MODIFIED! WELCOME TO THE REAL WORLD PRINCESS
sizes = [
{
"name": "item_1",
"size_in_mL": "100mL",
"alternate_identifier": "axc45"
},
{
"name": "item_2",
@simonw
simonw / recover_source_code.md
Last active December 25, 2025 23:58
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
const insert = (fn = (a, b) => a < b, item, list = []) => {
if (!list.length) {
return [item];
}
if (list.length === 1) {
return fn(item, list[0]) ? [item, list[0]] : [list[0], item];
}
let min = 0;
let max = list.length - 1;
while (true) {