Skip to content

Instantly share code, notes, and snippets.

Avatar
🌜

Jaakko Pallari jkpl

🌜
View GitHub Profile
@jkpl
jkpl / utpl_download.sh
Created Oct 22, 2011
Script that downloads Youtube playlist and extracts the audio from the downloaded clips.
View utpl_download.sh
#!/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 Oct 9, 2015
Credential getter for CFG formatted password files.
View pwget.py
#!/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 Feb 1, 2013
Wicd template for Eduroam networks (this should work on Univesity of Jyväskylä's jyu-student and jyu-staff networks).
View eap-ttls-pap
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 Feb 25, 2017
Reaktor Fast Track in Clojure
View fasttrack.clj
(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
Free monad based thread simulation and FRP constructs written in JavaScript. http://stuff.lepovirta.org/r/freefrp/
View freefrp.js
// 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
Macros for Poole
View macros.py
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
Spotify lookup in command line
View spotify.py
#!/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
Spotify app controls in command line
View spotifyctrl.sh
#!/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 Apr 1, 2019
keybase.md
View 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 Jul 28, 2015
Promise based queue
View box.js
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;
};