Skip to content

Instantly share code, notes, and snippets.

View kav2k's full-sized avatar

Alexander Kashev kav2k

  • DSL, University of Bern
  • Bern, Switzerland
  • X @kav2k
View GitHub Profile
var openPorts = ( function() {
var index = 0;
var ports = {};
var op = {
getPorts: function() {
var result = {};
for(var id in ports){
result[id] = ports[id];
}
return result;
function sanitize(str){
str = str.replace(/[<>:?*"\/\\|]/, "_", "g");
str = str.replace(/^(CON|PRN|AUX|NUL|COM\d|LPT\d)$/, "_", "i");
str = str.replace(/[. ]+$/, "_");
return str;
}
@kav2k
kav2k / gist:8e43cc175ec6301b61b3
Created January 5, 2015 18:05
Mare Internum RSS autodicovery tag
<!-- This goes into the head of every comic page / main page -->
<link rel="alternate" type="application/rss+xml" title="Mare Internum RSS" href="/feed">
for(int y = 0; y < 13; ++y)
{
for(int x = 0; x < 13; ++x)
{
Uint8 pixelOffset = _ufoTopView->getPixel(x, y);
if(pixelOffset == 0)
{
continue;
}
else
#include <stdio.h>
#include <stdlib.h>
#define s(_)sizeof(_)
#define n void*
#define z(_)_,_,_
#define x (s*)__
#define y (s*)_
#define h C(y,y)
#define o &d
#define t() (p)
@kav2k
kav2k / godville_firefox.user.js
Created April 29, 2013 13:13
A quick'n'dirty fix for current chat CSS problems at godville.net (Firefox version)
// ==UserScript==
// @name Godville chat fix (Firefox)
// @version 1.1
// @namespace tag:Xanos
// @description Fixes wraparound in Godville chat
// @include http://godville.net/*
// @include https://godville.net/*
// @grant GM_addStyle
// ==/UserScript==
@kav2k
kav2k / godville_chat_fix.css
Created April 29, 2013 14:17
CSS file for Godville chat fix
.fr_msg_l { white-space:normal !important; }
@kav2k
kav2k / g3sub.pl
Last active December 29, 2015 06:09
Gamers 3 subtitle translation converter. Usage: 1) Download the worksheet as plain text (will result in a TSV, Tab-Separated Values file) 2) Feed the file, with the column name containing the required language, to the script, example: `perl g3sub.pl E < worksheet.tsv > subtitles.srt` will produce English subtitles
#!perl -w
#
# Gamers 3 Subtitle File processing
# (c) Alexander Kashev, 2013
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OU
@kav2k
kav2k / holiday.ino
Last active December 31, 2015 06:09 — forked from Threeethan/gist:7938597
// This is the example sketch that gets loaded on every BlinkyTape during production!
#include <FastSPI_LED2.h>
#include <Animation.h>
#define LED_COUNT 60
struct CRGB leds[LED_COUNT];
#ifdef REVB // RevB boards have a slightly different pinout.
@kav2k
kav2k / button_interrupt.ino
Last active December 31, 2015 20:19
This sketch demonstrates how to set up and use Pin Change Interrupt to catch button presses on BlinkyTape.
// Example sketch for using interrupt-based button press detection
// It will check button state every 500ms and display it along with the push count
// It also sends this information over serial
#include <FastSPI_LED2.h>
#define LED_COUNT 60
struct CRGB leds[LED_COUNT];
#define LED_OUT 13