Skip to content

Instantly share code, notes, and snippets.

@andik
andik / cmdlineparams.txt
Created September 2, 2015 07:22
Openmodelica Simulation Runtime Command Line Parameters (version 1.9.1)
Command Line Parameters of Openmodelica (1.9.1) generated Simulation Binaries
<-abortSlowSimulation>
aborts if the simulation chatters
<-alarm=value> or <-alarm value>
aborts after the given number of seconds (0 disables)
@andik
andik / sfzparser.py
Last active November 11, 2016 20:28
super simple SFZ Parser in Python (Python 2.7)
# i claim no copyright on this code and place it in the public domain.
# do whatever you want with this code...
import argparse
parser = argparse.ArgumentParser(description='show differences of two views')
o = parser.add_argument
o('files', type=str, help='files to process', nargs='+')
#o('-b', '--boolarg', action='store_true', help="")
#o('-s', '--strarg', help="")
args = parser.parse_args()
@andik
andik / remove_birthdays.scpt
Created April 21, 2015 04:30
Wipe all Contact's Birthdays on Mac OS X
-- my previous phone miss-synced all my birthday entries to wrong dates
-- the first requirement to fix this is to have a white
-- canvas again. So removing all birthdays and ask people
-- and facebook for adding them again...
tell application "Contacts"
set peopleToChange to people
repeat with thePerson in peopleToChange
set the birth date of thePerson to missing value
end repeat
@andik
andik / loading.html
Created March 24, 2015 17:04
package flask using node-webkit
You can create a loading page and render the actual app after the web server has started.
The loading page (loading.html) will load a js file that launches your actual application page as a hidden window and you can then show it when the server is running.
<script>
var currentWindow = gui.Window.get(); // Get reference to loading.html
var exec = require('child_process').execFile;
exec('home.py', {cwd:'.'}, function (error, stdout, stderr){ // Runs your python code
var appWindow = gui.Window.open('app.html', // Starts your application
@andik
andik / linklist.js
Last active August 29, 2015 14:17
TinyMCE Link List
@andik
andik / dirtree.html
Last active January 22, 2024 19:12
Flask directory listing
<!doctype html>
<title>Path: {{ tree.name }}</title>
<h1>{{ tree.name }}</h1>
<ul>
{%- for item in tree.children recursive %}
<li>{{ item.name }}
{%- if item.children -%}
<ul>{{ loop(item.children) }}</ul>
{%- endif %}</li>
{%- endfor %}
@andik
andik / filebrowser.js
Created March 23, 2015 12:20
tinymce file browser
tinymce.init({
file_browser_callback: function(field_name, url, type, win) {
tinymce.activeEditor.windowManager.open({
title: "My file browser",
url: "myfilebrowser.html",
width: 800,
height: 600
}, {
oninsert: function(url) {
win.document.getElementById(field_name).value = url;
@andik
andik / various.hpp
Created March 18, 2015 22:17
C++ PP List and PP Typelists
#define List(o) \
o(1,2) \
o(2,3) \
#define MAP_CALL_FN_PARENS(...) (__VA_ARGS__);
#define MAP_CALL_FN(fn) fn MAP_CALL_FN_PARENS
#define MAP(list, fn, ...) list(MAP_CALL_FN(fn))
@andik
andik / app.py
Created March 18, 2015 15:38
serve static files from flask
from flask import Flask, request, send_from_directory
# set the project root directory as the static folder, you can set others.
app = Flask(__name__, static_url_path='')
@app.route('/js/<path:path>')
def send_js(path):
return send_from_directory('js', path)
if __name__ == "__main__":
@andik
andik / FuzzyMatch.js
Created March 6, 2015 07:56
Fuzzy matching
function fuzzy_match(text, search)
{
/*
Parameter text is a title, search is the user's search
*/
// remove spaces, lower case the search so the search
// is case insensitive
var search = search.replace(/\ /g, '').toLowerCase();
var tokens = [];
var search_position = 0;