Skip to content

Instantly share code, notes, and snippets.

Komosa / prepipe.cpp
Created Sep 18, 2018
pass thru, but color some words and cut some lines
View prepipe.cpp
#include <iostream>
#include <vector>
#include <cstdio>
using namespace std;
#define EACH(it, cont) for (auto &it: cont)
#define TermReset "\e[0m"
#define TermBlack "\e[0;30m"
#define TermRed "\e[0;31m"
# list of synaptics device properties
# list current synaptics device properties: xinput list-props '"SynPS/2 Synaptics TouchPad"'
#sleep 5 #added delay...
xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" 8 1
xinput --set-prop --type=int --format=32 "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Pressure" 4
xinput --set-prop --type=int --format=32 "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Width" 9 # Below width 1 finger touch, above width simulate 2 finger touch. - value=pad-pixels
Komosa /
Created Oct 13, 2017
nice awk trick
# remove files not in arrar 'files_to_keep'
find -type f -name '*.bin' \
| awk -v keep=" ${files_to_keep[*]} " -e 'keep !~ " "$0" "' \
| xargs -L1 -I II sh -c 'git rm -f II 2>/dev/null || rm II'
Komosa / stoper.html
Last active Sep 19, 2017
standup stoper
View stoper.html
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<title>Stoper to keep your standup under control (at least it duration)</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
body {
text-align: center;
View htmlize.go
package main
import (
View unyaml.go
package main
import (
yaml ""
Komosa / _test.go
Created Jul 11, 2016
error handling in golang tests
View _test.go
func Test(t *testing.T) {
fatalIf := func(err error) {
if err != nil {
err := os.MkdirAll(TEST_DATA_DIR, 0700)
View update_test.go
func TestUpdate(t *testing.T) {
defer os.RemoveAll(TEST_DATA_DIR)
if err := os.MkdirAll(TEST_DATA_DIR, 0700); err != nil {
if err := ioutil.WriteFile(TEST_DATA_DIR+"/number_of_partitions", []byte("2"), 0600); err != nil {
db, err := OpenDB(TEST_DATA_DIR)
Komosa / cookie.go
Created Mar 10, 2016
persistent cookie
View cookie.go
Komosa / remote.bat
Last active Feb 16, 2016
"Remote" execution of commands on windows with ssh-over-cygwin access
View remote.bat
if exist remote.done (
timeout 2
goto loop
call remote.recipe.bat
goto loop