Skip to content

Instantly share code, notes, and snippets.

@sirjofri
sirjofri / digraphs.ahk
Last active January 24, 2023 23:10
AutoHotKey vim digraphs
#SingleInstance force
digraph_mode := false
#<::
digraph_mode := !digraph_mode
return
#If digraph_mode = true
:*?C:-N::
@sirjofri
sirjofri / Makefile
Last active January 3, 2022 15:34
static site generator-chan
include config.mk
SITES=$(sort $(notdir $(basename $(wildcard $(SITESPATH)/*.*.inc))))
MKDFILES=$(sort $(basename $(wildcard $(SITESPATH)/*.*.md)))
LANG=$(subst .,,$(suffix $(SITES)))
all:
@$(PRECMD)
@make -s markdown
@make -s html
@sirjofri
sirjofri / Makefile
Created July 15, 2018 14:09
Farbfeld makefile enhancement
# define your outputs
output = tex1.ff tex2.ff tex3.ff
# include ff.mk only if it exists!
ifneq (,$(wildcard ff.mk))
include ff.mk
endif
# make a target for your outputs
output_files: $(output)
@sirjofri
sirjofri / buffer.h
Created July 15, 2018 12:58
dynamic buffer/array in C in 30 lines
#include <string.h>
#include <stdlib.h>
#define buffer(type) \
typedef struct type##_buf { \
size_t size; \
type *buffer; \
} type##_buf; \
void _resize_buffer_##type(struct type##_buf *buf) { \
type *newbuf = malloc((buf->size++)*sizeof(type)); \
@sirjofri
sirjofri / fscrot
Created September 1, 2017 13:24
scrot with filename, preview, mouse select and saving into a specific directory. I use it with dmenu on i3
#!/bin/bash
mkdir -p ~/scrot
if [ -z "$1" ]; then
scrot -s -e 'mv $f ~/scrot/$n ; feh ~/scrot/$n'
else
scrot -s ~/scrot/$1.png -e 'feh $f'
fi