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 bash | |
# Requires ripgrep to be installed | |
count_keymaps() { | |
n_def=$(bash find_default_keymaps.sh $1 | awk 'NF' | wc -l); | |
n_all=$(bash find_keymaps.sh $1 | awk 'NF' | wc -l); | |
printf "\nlayout: %s*\n# default keymaps: %d\n# def + user keymaps: %d\n" $1 $n_def $n_all | |
} | |
for layout in 60 65 66 68 75 tkl fullsize alice; do |
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
typedef unsigned long REG; | |
struct IORequest { | |
REG* buffer; | |
REG block; | |
int status; | |
IORequest* next; | |
} | |
IORequest *ioHead = nullptr; |
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
typedef unsigned int REG; | |
REG* io1Ctrl = ...; | |
REG* io1Status = ...; | |
REG* io1 | |
// volatile prevents compiler optimizations | |
static volatile REG* ioPtr = NULL; | |
static volatile int ioCount = 0; | |
static volatile bool ioCompleted = false; |
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
typedef unsigned REG; | |
struct IORequest { | |
REG* buffer; | |
unsigned size; | |
int status; | |
IORequest* next; | |
}; | |
IORequest* head; |
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
struct Node { | |
Node* leftChild; | |
Node* rightChild; | |
Node(Node* left = nullptr, Node* right = nullptr) | |
: leftChild{left}, rightChild{right} | |
{} | |
}; | |
void *(*wrapper)(void *n) { |
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 <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#define N ... | |
#define TIMEOUT 5000 | |
int main(int argc, char *argv[]) { | |
if (argc < 2) { | |
fputs("Fali argument\n", stderr); |
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 bash | |
# Bash | |
alias diff='diff --color=auto' | |
alias errcho='>&2 echo' | |
alias egrep='egrep --color=auto' | |
alias fgrep='fgrep --color=auto' | |
alias grep='grep --color=auto' | |
alias ls='ls --color=auto' | |
alias l='ls -CF' | |
alias la='ls -A' |
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
/* Bad */ | |
void f1(void) { | |
if (conditional1) { | |
action1(); | |
#ifdef COMPILE_OPTION_1 | |
} else if (conditional2) { | |
action2(); | |
#else | |
action3(); |
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
# Helper functions (lambda world → human-readable world) | |
to_bool = lambda b: b == true | |
to_int = lambda i: i(lambda x: x + 1)(0) | |
bprint = lambda *b: print(*map(to_bool, b)) | |
iprint = lambda *i: print(*map(to_int, i)) | |
# Church booleans | |
true = lambda x: lambda y: x |
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
from django.core.management import call_command | |
from django.core.serializers import base, python | |
from django.db import migrations | |
def load_fixture(apps, schema_editor): | |
old_get_model = python._get_model | |
def _get_model(model_identifier): | |
try: |
NewerOlder