Skip to content

Instantly share code, notes, and snippets.

View jkpl's full-sized avatar

Jaakko Pallari jkpl

View GitHub Profile
@jkpl
jkpl / utpl_download.sh
Created October 22, 2011 19:58
Script that downloads Youtube playlist and extracts the audio from the downloaded clips.
#!/bin/bash
## URL
# The URL to the Youtube playlist
URL="http://www.youtube.com/playlist?list=PL60BA016CD6B147F8"
## DESTPATH
# The path where to to download the music to
DESTPATH="$HOME/Music/awesome_new_music"
@jkpl
jkpl / pwget.py
Last active October 9, 2015 09:37
Credential getter for CFG formatted password files.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
from ConfigParser import ConfigParser
from subprocess import Popen, PIPE, STDOUT
# Place your own settings here
filepath = (os.environ['HOME'], '.mypwfile.gpg')
@jkpl
jkpl / eap-ttls-pap
Created February 1, 2013 18:46
Wicd template for Eduroam networks (this should work on Univesity of Jyväskylä's jyu-student and jyu-staff networks).
name = EAP-TTLS-PAP
author = jkpl
version = 1
require identity *Identity password *Password
optional ca_cert *Path_to_CA_cert anon_identity *Anonymous_Identity
protected password *Password
-----
ctrl_interface=/var/run/wpa_supplicant
network={
ssid="$_ESSID"
@jkpl
jkpl / fasttrack.clj
Last active February 25, 2017 23:48
Reaktor Fast Track in Clojure
(ns jkpl.fasttrack
(:require [clojure.string :as s]
[clojure.java.io :as io]))
(defn string-to-numbers
"Converts string of numbers to a list of numbers"
[s]
(->> (s/split s #" ")
(map read-string)))
@jkpl
jkpl / freefrp.js
Last active May 7, 2020 07:27
Free monad based thread simulation and FRP constructs written in JavaScript. http://stuff.lepovirta.org/r/freefrp/
// Free monad based thread simulation and FRP constructs written in JavaScript
// First, we need some way to express lazy values and actions.
// We can use zero-argument functions for this purpose: call the function and
// you get the value. We also need to compose lazy values/actions. For that
// we have bindLazy function. Lazy values are not expected to be pure
// in this program: evaluating a lazy value/action at different times can produce
// a different value.
@jkpl
jkpl / macros.py
Created May 12, 2015 14:51
Macros for Poole
import os
import json
import iso8601
from datetime import datetime
from lesscss import LessCSS
# Defaults
page = {}
pages = []
@jkpl
jkpl / spotify.py
Created May 30, 2015 18:47
Spotify lookup in command line
#!/usr/bin/python
import urllib
import sys
import json
import re
SP_REGEX = re.compile('^http://[\S]+/track/([\S]+)')
SP_LOOKUP_BASEURL = 'http://ws.spotify.com/lookup/1/.json?uri=spotify:track:%s'
@jkpl
jkpl / spotifyctrl.sh
Created May 30, 2015 18:50
Spotify app controls in command line
#!/bin/bash
SPOTIFYCMD="dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player."
function spotify_oper {
${SPOTIFYCMD}$1
}
case $1 in
"play")
@jkpl
jkpl / keybase.md
Last active April 1, 2019 18:12
keybase.md

Keybase proof

I hereby claim:

  • I am jkpl on github.
  • I am jkpl (https://keybase.io/jkpl) on keybase.
  • I have a public key ASA3n-ICY3CrHvBEUoW3UG4vA3md_9RKyDFL3AT30KJAswo

To claim this, I am signing this object:

@jkpl
jkpl / box.js
Created July 28, 2015 21:38
Promise based queue
function mkBox() {
var box = {values: [], reads: []};
box.enq = function(value) {
box.values.push(value);
if (box.reads.length > 0) {
box.reads.shift().resolve(box.values.shift());
}
return box;
};