Skip to content

Instantly share code, notes, and snippets.

@6r1d
6r1d / gist:4459143
Last active December 10, 2015 16:09 — forked from anonymous/gist:4458914
qx.Class.define("qx.ui.tabview.TabView", {
extend: qx.ui.tabview.TabView,
members: {
// Select next tab
next: function () {
var size = this.getSelectables().length;
var idx = this.getSelectables().indexOf(this.getSelection()[0]);
if (idx < size - 1) {
this.setSelection([this.getSelectables()[idx + 1]]);
@6r1d
6r1d / SnakeText.py
Created January 9, 2013 22:23
SnakeText: new version of an old joke
#!/usr/bin/python
# -*- coding: utf-8 -*-
import codecs
# Open file and load lines
with codecs.open('msg.txt', encoding='utf8') as f:
lines = [line.strip() for line in f]
@6r1d
6r1d / __init__.py
Last active December 19, 2015 08:29
bl_info = {
"name": "LAMMPS",
"author": "6r1d",
"blender": (2,6,7),
"version": (0,0,1),
"location": "File > Import-Export",
"description": "Import LAMMPS data format",
"category": "Import-Export"
}
ITEM: ATOMS id type xs ys zs
1 1 0.0118308 0.969562 0.016362
2 1 0.0206919 0.0223819 0.0382589
3 1 0.0732507 0.980683 0.0472193
4 1 0.963803 0.0565348 0.0858727
5 1 0.0857903 0.970805 0.984728
6 1 0.113903 0.0969731 0.00296579
7 1 0.160026 0.0580469 0.0292498
8 1 0.0988733 0.0396375 0.0322331
9 1 0.203053 0.0349323 -0.00915381
@6r1d
6r1d / gist:6199662
Created August 10, 2013 08:52
CSound-Python test to debug
# http://www.csounds.com/journal/issue14/realtimeCsoundPython.html
from csoundSession import *
cs = CsoundSession("simple.csd")
print cs.scoreEvent('e', ())
print cs.resetSession()
print cs.scoreEvent('a', (0, 0, 6000))
print cs.GetScoreTime()
@6r1d
6r1d / gist:7407790
Created November 11, 2013 04:18
Pagination debug
Backbone.View.extend({
// root view DOM-element
tagName: "div",
// events for root view DOM-element
events: {
"click .go_back": "back",
"click .go_forward": "forward",
"click .active a": "fire",
@6r1d
6r1d / gist:7443641
Created November 13, 2013 04:20
Centered pagination cases
case (position - radius > first_page && position + radius <= last_page):
pages = range_gen(position - radius, position + radius + 1, position);
break;
// - page is located near the left corner
case (position >= first_page && position <= first_page + radius):
pages = range_gen(first_page, first_page + (radius * 2) + 1, position);
break;
// - page is located near the right corner
case (position >= last_page - radius && position <= last_page):
pages = range_gen(last_page - (radius * 2), last_page + 1, position);
@6r1d
6r1d / all.lua
Last active June 2, 2020 08:09
Lite font update experiment
-- style.lua
-- First, I tried altering `style.lua` to add `fscale` attribute and a function to update style.
style.set_font = function()
style.padding = { x = common.round(14 * style.fscale), y = common.round(7 * style.fscale) }
style.divider_size = common.round(1 * style.fscale)
style.scrollbar_size = common.round(4 * style.fscale)
style.caret_width = common.round(2 * style.fscale)
style.tab_width = common.round(170 * style.fscale)
style.font = renderer.font.load(EXEDIR .. "/data/fonts/font.ttf", 14 * style.fscale)
style.big_font = renderer.font.load(EXEDIR .. "/data/fonts/font.ttf", 34 * style.fscale)
@6r1d
6r1d / split_midi.py
Last active June 10, 2020 14:54
A test music21 program to split a MIDI file into melodies.
"""
This program breaks a MIDI file to a number of melodies.
"""
from os import getcwd, listdir
from os.path import join as path_join, splitext, abspath
from music21 import midi, stream, instrument, key, meter, note, tempo
from pathlib import Path
INPUT_DIR = abspath(path_join(getcwd(), "in"))
@6r1d
6r1d / conf
Created December 18, 2020 12:40
Lighttpd config file for Emscripten
# Lighttpd configuration I am using with Emscripten.
#
# Probably there is a better solution
# and I am doing everything wrong.
#
# Start with:
# lighttpd -D -f lighttpd.conf
server.modules += ( "mod_setenv" )