Skip to content

Instantly share code, notes, and snippets.

Avatar

Jan Killian iki

View GitHub Profile
@iki
iki / logging.js
Last active Aug 29, 2015
Enable logs from your unit tests using logging.on|off() methods
View logging.js
/*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 Aug 29, 2015
Cleanup VM for exporting to appliance
View vm-cleanup
#!/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 Aug 29, 2015
shell script to download [kxl]ubuntu release iso ... just rename the script to requested edition-release-type-platform
View ubuntu-14.04-desktop-amd64.sh
#!/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 Sep 17, 2014
snippets for dynamic color scheme
View app.js
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) {
View test-dict-ordering.coffee
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
View normalize-flow-tsv.py
#!/usr/bin/env python
from __future__ import print_function
import re
import os
import sys
import glob
LF = '\n'
View get-kamaelia.sh
#!/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
View tmux4group.sh
#!/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"
View Sabayon_Linux_DAILY_amd64_K.update.sh
# 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