Skip to content

Instantly share code, notes, and snippets.

View skriticos's full-sized avatar

Sebastian Bartos skriticos

  • pgsw.eu
  • Germany
View GitHub Profile
#! /bin/bash
# 2014-04-22, v1.0, pull, push, initial clone of projects
# 2014-04-26, v2.0, speed improvement, use hashtable to determine push/pull
# automatically pull new projects based on remote hashtable
# setting up new repo (note: we should automate this at some point):
# create local git repo in projects (~/projects/xxx_name)
# login remote, create git repo $remote/"$target".git
# local git remote add "$remote"/
@skriticos
skriticos / normalize.sh
Created January 6, 2014 15:51
iterate all go files in current directory and run them with the go fix and gofmt tool
#! /bin/bash
for f in *.go
do
echo "processing $f"
go fix "$f"
gofmt -w "$f"
done
@skriticos
skriticos / coverage.sh
Created January 6, 2014 15:49
quick generic go coverage script (terminal function percentage and browser details)
#! /bin/bash
go test -coverprofile=coverage.out; go tool cover -func=coverage.out; go tool cover -html=coverage.out; rm coverage.out
@skriticos
skriticos / typeflow.go
Last active December 31, 2015 15:09
golang control flow in a linked list based on element type using type assertion
// go control flow in a linked list based on element type using type assertion
package main
import (
"fmt"
"reflect"
"container/list"
)
type Foo struct {
@skriticos
skriticos / base.xml
Last active August 8, 2021 07:04
Modified Dvorak layout xkb configuration /usr/share/X11/xkb/symbols/us /usr/share/X11/xkb/rules/base.xml /usr/share/X11/xkb/rules/evdev.xml optionally delete /var/lib/xkb/*
..
<variant>
<configItem>
<name>dvorak-sk-custom</name>
<description>English (SK Custom Dvorak)</description>
</configItem>
</variant>
..
@skriticos
skriticos / QTreeView.1.py
Last active January 3, 2023 08:33
Simple QTreeView example
#! /usr/bin/env python3
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# In this prototype/example a QTreeView is created. Then it's populated with
# three containers and all containers are populated with three rows, each
# containing three columns.
# Then the last container is expanded and the last row is selected.
# The container items are spanned through the all columns.
# Note: this requires > python-3.2
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
import sys, os, pprint, time
@skriticos
skriticos / tablemodel.py
Created October 22, 2012 14:30
Create a table model from a two dimensional array in Python 3 / PySide (Qt).
#! /usr/bin/env python3
import sys
from PySide.QtCore import *
from PySide.QtGui import *
"""
Create a table model from a two dimensional array,
first element being the header.
@skriticos
skriticos / play-random.sh
Created January 2, 2011 20:04
One liner to play media files in folder tree with mplayer (shuffeled and full screen)
#! /bin/bash
# play files in random order
find . -type f \( -name "*.mkv" -o -name "*.avi" -o -name "*.flv" \) -print0 | xargs -0 mplayer -shuffle -fs
" 2010-08-11..2010-08-13
" Saves current buffer and executes it.
" If the buffer doesn't have a filename, it is stored in a temp location.
function! SF_run()
if bufname("%") == ""
let PATH = "/tmp/".localtime().".vim"
else
let PATH = bufname("%")
endif
exec ":write ".PATH
@skriticos
skriticos / __init__.py
Created March 30, 2010 10:35
Python test runner.
# Python test runner. Add more tests with the test_sequence list.
# This assumes that the project to be tested is two folders above (../..)
# POSIX only
import os
import sys
import shutil
NAME = "TEMPLATE"