Skip to content

Instantly share code, notes, and snippets.

@iiska
iiska / Nettiradiot.m3u
Created June 6, 2009 11:02
Lähes kaikki Suomalaisten radioasemien nettiradiot.
#EXTM3U
#EXTINF:0,Bassoradio
http://83.145.201.209:8000/
#EXTINF:0,Classic Radio
http://217.30.180.242:8000/clsr.ogg
#EXTINF:0,Groove FM
http://217.30.180.242:8000/gvfm.ogg
@iiska
iiska / Autostart.sh
Created January 9, 2012 14:05
Using KWallet and ksshaskpass with ssh-agent
#! /bin/bash
# Put this in ~/.kde/Autostart/ssh-agent.sh
export SSH_ASKPASS=/usr/bin/ksshaskpass
/usr/bin/ssh-add
@iiska
iiska / validator.py
Created October 22, 2009 10:17
Simple XML Schema validator in Python using lxml library
#! /usr/bin/python
# -*- coding: utf-8 -*-
#
# Simple XML validator done while learning the use of lxml library.
# -- Juhamatti Niemelä <iiska AT iki DOT fi>
import lxml
from lxml import etree
if __name__ == "__main__":
@iiska
iiska / print_cookies.py
Created May 7, 2012 12:42
Using urllib2 and cookielib to print cookies from GET request
import urllib2
import cookielib
cookie_jar = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookie_jar))
urllib2.install_opener(opener)
request = urllib2.Request('http://www.google.com')
urllib2.urlopen(request)
@iiska
iiska / db_fixtures_dump.rake
Created December 28, 2011 13:17
Dump Rails db to fixtures
# Original from http://snippets.dzone.com/posts/show/4468 by MichaelBoutros
#
# Optimized version which uses to_yaml for content creation and checks
# that models are ActiveRecord::Base models before trying to fetch
# them from database.
namespace :db do
namespace :fixtures do
desc 'Dumps all models into fixtures.'
task :dump => :environment do
models = Dir.glob(RAILS_ROOT + '/app/models/**.rb').map do |s|
@iiska
iiska / post-receive
Created April 2, 2012 07:21
Post-receive hook which generates html from README.md to be used with gitweb
#!/bin/sh
#
# Post-receive hook script which generates README.html to git-dir from
# README.md found at the head of master branch in repository.
#
# Gitweb can read the README.html and embed it to the project summary page.
git cat-file blob HEAD:README.md | markdown > $GIT_DIR/README.html
@iiska
iiska / convert.py
Created October 24, 2012 12:56
Convert sample.jtl to csv
#! /usr/bin/env python
from xml.etree import ElementTree
from xml.sax.handler import ContentHandler
from xml.sax import parse
import csv
@iiska
iiska / webpack.config.js
Created August 7, 2017 18:34
Webpack configuration for my Hugo sites
const webpack = require("webpack");
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const ManifestPlugin = require("webpack-manifest-plugin");
const autoprefixer = require("autoprefixer");
const path = require("path");
module.exports = {
entry: {
main: [
"./assets/javascripts/index.js",
@iiska
iiska / candles.rb
Created December 4, 2012 15:30
Candle puzzle encountered in IRC
#! /usr/bin/env ruby
# Finds answer to following puzzle
#
# There are one thousand candles on the altar and one thousand priests
# in the temple. Their god asks the first priest to go and light all
# the candles. Then he has the second priest go to every second candle
# and put it out."
#
# The third goes to every third candle and, if it is not burning, he