Skip to content

Instantly share code, notes, and snippets.

View skriticos's full-sized avatar

Sebastian Bartos skriticos

  • pgsw.eu
  • Germany
View GitHub Profile
@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 / 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 / pygtk-cairo-opaque-xshape-window-from-png.py
Created April 17, 2009 21:06
Transparent, irregular edge splash screen with pyGTK and XShape.
""" Transparent, irregular edge splash screen with pyGTK and XShape.
Takes a png image with transparent section, creates a window with pyGTK, puts this image in
there with cairo and then trims the edges with X11 XShape clipping extension.
This file demonstrates a python script which loads a png image of size 800x650 and name base.png
Then it creates a GTK+/Cairo window with opaque settings from the png file and the transparent
portions cut out with a mask. Basic, but works and looks great.
Note: this is a proof of concept file. It works, but it is by no means production ready.
"""
" Seth Kriticos' vimrc file
" Last update: 2010-03-19
" Note - This configuration is for cterm mode (color terminal)
" Never got around liking the GUI version
" (problematic command line integration)
" For GUI use, the highlight commands should be adjusted
" Editor behaviour
set nocompatible
set autoread
#! /usr/bin/env python3
""" Linux / *NIX daemon base code.
This script daemonizes its self with the start option and kills an already
running daemon with the stop option. It's kept minimal and simple, but it works
and can be extended/re-factored as base-code for a useful daemon.
Note: point of daemons is that they are quite and run in the background, add
some logging if you are developing a daemon, saves a lot of headaches.
"""
@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 / 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 / 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 / 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