Skip to content

Instantly share code, notes, and snippets.

@c00kiemon5ter
c00kiemon5ter / monsterwm2bar
Created February 25, 2012 02:40
monsterwm output to dzen2 or some_sorta_bar
ff="/tmp/monsterwm.fifo"
[[ -p $ff ]] || mkfifo -m 600 "$ff"
# desktop names
ds=("web" "dev" "foo" "null")
# layout names
ms=("T" "M" "B" "G" "F")
while read -t 60 -r wmout || true; do
@c00kiemon5ter
c00kiemon5ter / Answers.csv
Created March 13, 2012 16:17
convert csv formated data to json
We can't make this file beautiful and searchable because it's too large.
AQCod,AAA,ALect,ACorr,ASound
1,1,"Περνάτε στην 3η ταχύτητα.",1,"SA-1-1"
1,2,"Περνάτε στην 5η ταχύτητα.",0,"SA-1-2"
2,1,"Εννέα και τέταρτο ως δέκα και δέκα.",1,"SA-2-1"
2,2,"Εννέα.",0,"SA-2-2"
2,3,"Έντεκα και πέντε.",0,"SA-2-3"
3,1,"Έχετε «βάλει» την 1η ταχύτητα και πιέζετε τον ποδομοχλό του συμπλέκτη.",0,"SA-3-1"
3,2,"Έχετε το μοχλό ταχυτήτων στη «νεκρά» και πιέζετε τον ποδομοχλό της πέδης (φρένο).",1,"SA-3-2"
3,3,"Έχετε το μοχλό ταχυτήτων στη «νεκρά» και πιέζετε τον ποδομοχλό του συμπλέκτη.",0,"SA-3-3"
4,1,"Μόνο όταν έχετε πρόθεση να αλλάξετε κατεύθυνση προς τα αριστερά.",0,"SA-4-1"
@c00kiemon5ter
c00kiemon5ter / Makefile
Created April 9, 2012 14:17
mparser - a simple parser for monsterwm's output
# Makefile for mparser - see UNLICENSE for nonlicense and noncopyright information
VERSION = cookies-git
NAME = mparser
PREFIX ?= /usr/local
BINDIR ?= ${PREFIX}/bin
INCS = -I. -I/usr/include
LIBS = -L/usr/lib -lc
@c00kiemon5ter
c00kiemon5ter / pipes
Created April 22, 2012 15:14
fill your terminal with colored pipes/tubes
#!/bin/bash -e
declare -i f=75 s=13 r=5000 t=0 c=1 n=0 l=0
declare -i x=$((w/2)) y=$((h/2))
declare -ar v=( [00]="\x83" [01]="\x8f" [03]="\x93"
[10]="\x9b" [11]="\x81" [12]="\x93"
[21]="\x97" [22]="\x83" [23]="\x9b"
[30]="\x97" [32]="\x8f" [33]="\x81"
)
trap "clear; tput rmcup; tput cnorm" EXIT
The "right-left" rule is a completely regular rule for deciphering C
declarations. It can also be useful in creating them.
First, symbols. Read
* as "pointer to" - always on the left side
[] as "array of" - always on the right side
() as "function returning" - always on the right side
as you encounter them in the declaration.
@c00kiemon5ter
c00kiemon5ter / scratchpad.sh
Created September 13, 2012 16:47
script to toggle visibility of a terminal
#!/bin/sh
name="scratchpad"
class="URxvt"
# print the window id of the window with the given
# instance name as the first argument '$1' and
# class name as the second argument '$2'
get_win_id() {
xwininfo -root -children -int | awk -v n="$1" -v c="$2" '$3 == "(\""n"\"" && $4 == "\""c"\")" { print $1 }'
@c00kiemon5ter
c00kiemon5ter / res_name.diff
Created October 1, 2012 14:46
patch to allow the configuration of the instance name of xtmux window on the command line
diff --git a/tmux.c b/tmux.c
index 5d82ff5..3331f67 100644
--- a/tmux.c
+++ b/tmux.c
@@ -52,6 +52,7 @@ pid_t environ_pid = -1;
int environ_idx = -1;
#ifdef XTMUX
char *xdisplay = NULL;
+char *res_name = NULL;
#endif
@c00kiemon5ter
c00kiemon5ter / nwm.c
Created January 3, 2013 00:14
the non window manager in 9 lines of code
/* under cookie license -- all cookies (C) reserved
* contact c00kiemon5ter on freenode
*
* build
* -----
* make nwm CFLAGS="-std=c99 -Wall -Wextra -pedantic -Os -lX11" LDFLAGS="-s"
*
* usage
* -----
* setup your ~/.xinitrc and startx
@c00kiemon5ter
c00kiemon5ter / sys_monitor
Last active December 10, 2015 16:38
working on a script asked by @kuraku on [arch forums](https://bbs.archlinux.org/viewtopic.php?pid=1213820#p1213820)
#!/usr/bin/env bash
# Status script
# original: https://bitbucket.org/jasonwryan/eeepc/src/fefeccd4b280/Scripts/dwm-status
# colours: 01:normal 02:green 03:orange 04:red 05:gray 06:blue
## sleep interval - delay between updates
declare -r interval=3
## color definitions
@c00kiemon5ter
c00kiemon5ter / sic.sh
Created January 10, 2013 16:59
iii alike frontend for sic
#!/usr/bin/env sh
: "${c:=12}" # max channel width
: "${n:=12}" # max user name width
: "${p:=1}" # prettify - colors and stuff
: "${w:=110}" # max mesg width
: "${s:="|"}" # the separator
trap "stty '$(stty -g)'; kill -TERM 0" EXIT
stty -echonl -echo