Skip to content

Instantly share code, notes, and snippets.

@kanedo
kanedo / Makefile
Last active May 7, 2020 00:55
Makefile for Xcode C++ projects
#############################################################
# #
# Generic Makefile for C++ projects #
# Author: Gabriel <software@kanedo.net> #
# Date: 2014-04-18 #
# Version: 1.0 #
# #
#############################################################
@kanedo
kanedo / triangle_filter.py
Created October 24, 2018 08:52
triangle smoothing filter in python
def triangle_filter(self, n):
f = np.zeros((1+2*n))
for i in range(n):
f[i] = i+1
f[-i-1] = i+1
f[n] = n + 1
return f / np.sum(f)
filter = triangle_filter(smoothing_factor)
tmp = np.pad(data, smoothing, mode='edge')
@kanedo
kanedo / csvToMMD.swift
Created March 20, 2018 12:29
csv to multimarkdown
#!/usr/bin/swift -suppress-warnings
// based on https://chrisbrandow.svbtle.com/csv-to-multimarkdown-tables
import Foundation
let separators: [Character: String] = ["=": ":---:", ">": "----:", "<": ":----"]
let separatorSet = CharacterSet(charactersIn: "><=, ")
func csv(data: String) -> [[String]] {
var result: [[String]] = []
let rows = data.components(separatedBy: "\n")
@kanedo
kanedo / fertility bias window construction.ipynb
Created March 7, 2018 15:04
use mxnet.nd.gather_nd to create matrix for fertility bias (Cohn et al, 2016)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Symbol List</string>
<key>scope</key>
<string>meta.function.headline.latex</string>
<key>settings</key>
<dict>
<?php # -*- coding: utf-8 -*-
/**
* Create a nav menu with very basic markup.
*
* @author Thomas Scholz http://toscho.de
* @version 1.0
*/
class T5_Nav_Menu_Walker_Simple extends Walker_Nav_Menu
{
/**
#!/usr/bin/python
# CLI program to control the mediakeys on OS X. Used to emulate the mediakey on a keyboard with no such keys.
# Easiest used in combination with a launcher/trigger software such as Quicksilver.
# Main part taken from http://stackoverflow.com/questions/11045814/emulate-media-key-press-on-mac
# Glue to make it into cli program by Fredrik Wallner http://www.wallner.nu/fredrik/
import Quartz
import sys
@kanedo
kanedo / fermat.hs
Created December 19, 2012 20:12
Fermat's little theorem
fermat :: (Integral i, Show i) => i -> Bool
fermat 1 = True -- Fermat's litte theorem only works for
fermat 2 = True -- numbers greater then 2
fermat x = not (null [x | y<-[2.. pred x], (y^(x-1) `mod` x) == 1])
@kanedo
kanedo / 2015-10-18_7173497_rollefbachviadukt-und-indetalweg_export.geojson
Created October 18, 2015 17:47
Rollefbachviadukt - Kornelimünster - Indetalrundweg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kanedo
kanedo / function.php
Created September 13, 2012 09:32
Add language descriptor to wordpress adminbar
/*
Plugin Name: Language Descriptor for admin Bar
Plugin URI: http://kanedo.net
Description: Add language descriptor to wordpress adminbar
Version: 1.0