Skip to content

Instantly share code, notes, and snippets.

View tuner's full-sized avatar

Kari Lavikka tuner

View GitHub Profile
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
cadd
9.66
21.4
2.411
4.71
3.031
8.46
17.16
0.461
0.046
@tuner
tuner / sgd.R
Created April 29, 2018 13:16
Stochastic Gradient Descent
# (c) Kari Lavikka
######### Stochastic gradient descent "library" ##########
gradient_descent <- function(x, y,
validation_x, validation_y,
loss_function, gradient_function,
step_function,
lambda, M,
normalize = FALSE) {
@tuner
tuner / sne.R
Created April 16, 2018 09:43
Stochastic neighborhood embedding in R
#
# (c) Kari Lavikka 2018
#
library(stats)
source("mnist.R")
mnist <- load_mnist()
@tuner
tuner / spam_bayes.py
Created September 27, 2017 08:44
Bayes spam "filter"
import re
import pathlib
from collections import defaultdict
from math import log, exp
def read_table(filename):
pattern = re.compile("^\s+(\d+)\s+([^\s]+)$")
table = {}
@tuner
tuner / flask_test.py
Created June 19, 2017 16:48
sqlite & flask test
from flask import Flask, g, render_template
import sqlite3
import html
app = Flask(__name__)
def get_db():
"""Opens a new database connection if there is none yet for the
current application context.
"""
@tuner
tuner / snake.py
Created March 11, 2017 15:02 — forked from sanchitgangwar/snake.py
Snakes Game using Python
# SNAKES GAME
# Use ARROW KEYS to play, SPACE BAR for pausing/resuming and Esc Key for exiting
import curses
from curses import KEY_RIGHT, KEY_LEFT, KEY_UP, KEY_DOWN
from random import randint
curses.initscr()
win = curses.newwin(20, 60, 0, 0)
@tuner
tuner / CmsFaceletCache.java
Created August 26, 2016 06:50
A FaceletCache that expires facelets by using a FileWatcher
package fi.bdb.cms.utils;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
@tuner
tuner / IncludeBean.java
Created June 4, 2015 18:22
JSF dynamic <ui:include> problem
import javax.faces.bean.SessionScoped;
import javax.faces.view.ViewScoped;
import javax.inject.Named;
import java.io.Serializable;
/**
* @author Kari
*/
@Named
@ViewScoped

Keybase proof

I hereby claim:

  • I am tuner on github.
  • I am klavikka (https://keybase.io/klavikka) on keybase.
  • I have a public key whose fingerprint is 297D EB71 AE84 46D7 4BD6 6FD5 C2CA 3963 DF9A 4818

To claim this, I am signing this object:

package harjoitus9;
import java.util.Arrays;
import java.util.List;
/**
* @author Kari
*/
public class Alkusolmu {
static class Solmu {