Skip to content

Instantly share code, notes, and snippets.

View iki's full-sized avatar

Jan Killian iki

View GitHub Profile
@iki
iki / logging.js
Last active August 29, 2015 13:57
Enable logs from your unit tests using logging.on|off() methods
/*Enable logs from your unit tests using logging.on|off() methods.
Provides stringifier to stripped JSON for safe logging of objects
with cyclical references, DOM elements, angular scopes, or window.
By default, logging.on/off() works with window.console,
or with $log service if angular is detected.
By default, logging class attaches to jasmine.logging,
or mocha.logging, or window.logging.
@iki
iki / vm-cleanup
Last active August 29, 2015 13:58
Cleanup VM for exporting to appliance
#!/bin/bash
#|Usage: <command> [OPTIONS]
#|
#|Clean development VM for exporting to appliance:
#|
#| - update system: apt-get update and upgrade
#| - install zerofree package
#| - remove user ssh keys
#| - stop foreman and django
#| - stop mongodb, compact database, purge journal
@iki
iki / ubuntu-14.04-desktop-amd64.sh
Last active August 29, 2015 13:59
shell script to download [kxl]ubuntu release iso ... just rename the script to requested edition-release-type-platform
#!/bin/sh
name="${0##*/}"
name="${name%.sh}"
edition="${name%%-*}"
version="${name#*-}"
version="${version%%-*}"
# use main ubuntu cdimage server
if [ "$edition" = 'ubuntu' ]; then
@iki
iki / app.js
Created September 17, 2014 14:37
snippets for dynamic color scheme
if (settings.mainColor) {
_.each(document.styleSheets, function(styleSheet) {
if (styleSheet.title === 'mainColor') {
_.each(styleSheet.cssRules || styleSheet.rules, function(rule) {
if (rule.type === 1 && rule.cssText && rule.style) {
if (rule.cssText.indexOf('BgColor') !== -1) {
console.log('style: background color ' + settings.mainColor + ' @ ' + rule.cssText, {rule: rule});
rule.style.backgroundColor = settings.mainColor;
}
if (rule.cssText.indexOf('FontColor') !== -1) {
fs = require 'fs'
log = console.log
dump = (obj) -> JSON.stringify obj, null, 2
keys = Object.keys
src = process.argv[2] or 'package.json'
log src
pkg = JSON.parse fs.readFileSync src
log 'JSON: ' + dump pkg
#!/usr/bin/env python
from __future__ import print_function
import re
import os
import sys
import glob
LF = '\n'
#!/bin/sh
VER=0.9.8.0
MD5=13c5539712041c80b1a9ec65515694fd
APP=Kamaelia-$VER
PKG=Original-$APP-with-Axon.tar.gz
URL=http://www.kamaelia.org/release/MonthlyReleases/$APP.tar.gz
DST=dist-external
if [ "$OS" = "Windows_NT" ]; then
#!/bin/sh
N="${1:-projectx}"
I="${2:-0}"
echo "=== Opening terminal multiplexer server [$N] session [$I]"
G="tmux-$N" # group name
D="/var/lib/tmux/sockets/$N"
S="$D/.shared"
# Download/update daily Sabayon Linux image via rsync
# List of mirrors: http://www.sabayon.org/download
# Available files: http://na.mirror.garr.it/mirrors/sabayonlinux/iso/daily/
# Settings:
R=rsync://na.mirror.garr.it/sabayonlinux/iso/daily
# R=rsync://ftp.sh.cvut.cz/sabayon/iso/daily # frozen on 2010-05-15
N=Sabayon_Linux_DAILY_
T=. # target directory