Skip to content

Instantly share code, notes, and snippets.

View dk949's full-sized avatar

David K dk949

View GitHub Profile
@dk949
dk949 / pegd.d
Created October 1, 2022 20:21
read PEG file and generate a D parser for it with pegged
/+dub.json:
{
"authors": ["dk949" ],
"copyright": "Copyright © 2022, dk949",
"dependencies": { "pegged": "~>0.4.6" },
"description": "compiler for standalone pegged grammars",
"license": "BSL-1.0",
"name": "pegd"
}
+/
@dk949
dk949 / e.hs
Last active January 10, 2024 19:52
e
module E where
e = sum $ take 171 $ map ((\a b -> fromIntegral a / fromIntegral b) 1 . \f -> product [1 .. f]) [0 ..]
main = print e
@dk949
dk949 / genslurm
Created October 13, 2022 09:25
Genrate slurm script
#!/bin/bash
set -e
___EXCLUSIVE="#SBATCH --exclusive"
___CPUS_PER_TASK="1"
help(){
echo "
Every option can be set from the command line or vie an env variable.
Command line takes priority.
/* License: MIT. See end of file.
Overview:
This implementation is heavily based on macros (it's nothing but
macros). In order to get actual functions and structs they need to be
instantiated. Two helpers are provided for this: DECLARATIONS_Queue(T)
and DEFINITIONS_Queue(T). Place DECLARATIONS_Queue(T) in one (1) header
file. Place DEFINITIONS_Queue(T) in one (1) source file which includes
that header file. Define GENERIC_QUEUE_IMPL before including. Replace T
with your desired type. See example below
@dk949
dk949 / Makefile
Last active April 1, 2024 20:56
A makefiel for compileing C and C++ projects with support for debug and release modes.
########################### High level configuration ###########################
# If building a library (see DO_BUILD_LIB below) do not add prefix and extension
# i.e. use myLibName instead of libmyLibName.a
OUT_NAME = myExeName
VERSION=0.1.0
# Compiler, linker, archiver, package config
CC ?= gcc
CXX ?= g++
@dk949
dk949 / cstimer_dracula.md
Created January 11, 2023 19:26
Dracula theme for cstimer.net

Dracula theme for csTimer

How to apply

In options go to the Color tab, select manual color scheme and press export. Paste the following code into the dialog box.

Just Ui colors

N4Igxg9gNhBOIC4QFcQBpzQLQDMIDsAXREAYhwA5KcAmdTKLAIwEMwBrE0mimlgZgBs9SIyYQWsACZcALPIDsAVhYjsTZIUIEuTKQE5+OfWsZQAlvk5JSSgAw4WCpqawwA5hC44AjI4pgrh4QrBxcPHxCIAC+QA
@dk949
dk949 / .vimrc
Last active December 20, 2024 18:50
*Very* basic vimrc to use on remote computers
" Options
filetype plugin on
filetype plugin indent on
syntax on
set number relativenumber
au InsertLeave * set number relativenumber
au InsertEnter * set number norelativenumber
@dk949
dk949 / numbered-links.lua
Last active January 10, 2024 20:00
Pandoc numbered section links
@dk949
dk949 / todonotes.lua
Last active May 15, 2023 22:27
Pandoc filter to insert todonotes todos without inline latex
--[[
See bottom of scrip for license
Usage:
---
header-includes: |
\usepackage{todonotes}
...
@dk949
dk949 / build_zls.sh
Last active August 11, 2023 12:21
Build zls for different versions of Zig
#!/bin/bash
set -e
# VERSION_LIST=("0.7.0" "0.7.1" "0.8.0" "0.8.1" "0.9.0" "0.9.1" "0.10.0" "0.10.1" "0.11.0" "master")
VERSION_LIST=("0.9.1" "0.10.1" "0.11.0" "master")
git clone https://github.com/zigtools/zls
cd zls