This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OUT ?= build | |
PROGRAM = example | |
.PHONY: build | |
build: $(OUT)/build.ninja | |
ninja -C $(OUT) $(PROGRAM) | |
.PHONY: setup | |
setup: $(OUT)/build.ninja |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <cstddef> | |
#include <cstdint> | |
#include <cstring> | |
#include <cstdlib> | |
#include <functional> | |
template< | |
typename Key, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Create reverse SSH tunnel | |
[Service] | |
User=martin | |
ExecStart=/usr/bin/autossh -N -T -o 'ServerAliveInterval 10' -o 'ServerAliveCountMax 2' -R 0.0.0.0:<SERVER PORT>:localhost:22 <SERVER> | |
Restart=always | |
RestartSec=5s | |
[Install] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "hashmap.h" | |
#include <stdint.h> | |
#include <stdlib.h> | |
static uint32_t strhash(const char *str) | |
{ | |
// I'm sitting at an airplane as I'm writing this, | |
// I don't have access to resources on what reasonable hash algorithms, | |
// I need something and this is something |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# This program uses gnome-randr (https://github.com/maxwellainatchi/gnome-randr-rust) | |
# to change display configurations for the duration of a process. | |
# It's intended to use with games if you're normally using the computer with | |
# DPI scaling enabled. | |
# Usage: gamerandr <config> [command...] | |
# It can be used with Steam by changing the launch options of a game to: | |
# gamerandr <config> %command% | |
# For example, I use 'gamerandr fps %command%' for Counter-Strike 2, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys | |
import traceback | |
import subprocess | |
class Reader: | |
def __init__(self, f): | |
self.f = f | |
self.next = f.read(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
project('test', 'cpp') | |
clang_tidy_prog = find_program('clang-tidy', required: false) | |
run_clang_tidy_prog = find_program('./run-clang-tidy.sh') | |
clang_format_prog = find_program('clang-format', required: false) | |
run_clang_format_prog = find_program('./run-clang-format.sh') | |
srcs = [ | |
'src/foo.cc', | |
'src/bar.cc', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <unistd.h> | |
#include <linux/videodev2.h> | |
#include <errno.h> | |
#include <sys/types.h> | |
#include <sys/stat.h> | |
#include <sys/eventfd.h> | |
#include <sys/mman.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -eu | |
token='<your API token>' | |
zone='<your DNS zone ID>' | |
record='<your DNS record ID>' | |
ip_url='ifconfig.co' | |
call() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# SST: SSH, but reliable, using tmux. | |
# When you lose connection, the connection will be re-tried, and you will get back where you | |
# left off. | |
# An aggressive heartbeat setting is used to detect network issues much more reliably than | |
# SSH's default settings would. | |
# | |
# Usage: | |
# sst <host>: Create a temporary tmux session, which will be killed when it hasn't |
NewerOlder