Skip to content

Instantly share code, notes, and snippets.

======= Makefile =======
CFLAGS = -Wall -Wextra -O0 -g3 -ggdb3 `pkg-config --cflags x11 cairo pangocairo`
LDFLAGS = -O0 `pkg-config --libs x11 cairo pangocairo`
all: ui-cairo-x11
ui-cairo-x11: ui-cairo-x11.o
paste -d'|' \
<( ls --color=never -a -p -1 --ignore='.[[:alnum:]]*' "${1}" | tail -n+1 ) \
<( ls --color=never -a -p -1 -d "${1}/"{.,..,*} ) \
| bbe -e 's/|/\0info\x1f/'
@nick87720z
nick87720z / perf.h
Last active June 15, 2020 15:06
Inline counter wrapper
#include <time.h>
#include <stdio.h>
/* In-place counter wrapper code */
#define begin_perf(time, idle_time, name) { \
clock_t tstart = clock (); \
clock_t tcur = 0; \
guint64 counter = 0; \
int sec = -(idle_time); \
@nick87720z
nick87720z / config.rasi
Created June 17, 2020 10:50
my-rofi-theme
configuration {
modi: "window,windowcd,run,drun,ssh,file-browser,calc,keys,combi";
/* width: 3;*/
/* lines: 15;*/
/* columns: 1;*/
font: "mono 10";
bw: 1;
location: 2;
padding: 0;
yoffset: 26;
#!/bin/sh
# https://stackoverflow.com/a/37105443
fatal() {
printf '%s\n' "$1"
exit 1
}
path=
depth=1
@nick87720z
nick87720z / dunstrc
Created May 20, 2021 12:17
My dunst config
[global]
monitor = 0
follow = mouse
geometry = "0x5-15+30"
indicate_hidden = yes
shrink = yes
transparency = 0
notification_height = 0
separator_height = 1
padding = 2
@nick87720z
nick87720z / signal_handling.c
Last active June 14, 2021 13:04
Testing, how signals are handled when not blocked for handler execution time
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <signal.h>
void action_usr1 (int sig)
{
sleep (3);
puts ("usr1");
fflush (stdout);
#!/bin/bash
# exec depends: git, sed, sort
# commit archive url formats:
# repo.or.cz: ${GIT_REPO_URI}/snapshot/${COMMIT}.tar.gz
# github: ${GIT_REPO_URI}/archive/${COMMIT}.tar.gz
# gitlab: ${GIT_REPO_URI}/-/archive/${COMMIT}/${PROJECT}-${COMMIT}.tar.bz2
# git.tuxfamily.org,
# savannah/cgit: ${GIT_REPO_URI}/snapshot/${PROJECT}-${COMMIT}.tar.gz
#!/bin/bash
TIMEOUT=${TIMEOUT:-10} # seconds
COLOR=${COLOR:-1} # 0 or 1
LOG_LEVEL=${LOG_LEVEL:-1} # 0..2
newline() { printf '\n'; }
line_over() { printf "${cl_back}"'\r%s' "$1"; }
cl_back="$(tput el1)"