Skip to content

Instantly share code, notes, and snippets.

View davidlj95's full-sized avatar

David LJ davidlj95

View GitHub Profile
@kg583
kg583 / hello_world.py
Created August 7, 2022 22:42
Hello World! with only 2 distinct punctuation marks
from operator import attrgetter
from operator import itemgetter
@itemgetter
@slice
@int
@next
@reversed
@str
@tsimbalar
tsimbalar / exercise-status.dart
Created February 4, 2021 14:05
exercise status
// from the outside we see :
abstract class Step{
bool get isLocked; // computed based on the state of previous steps
// = !(previousExercise === null || previousExercise.isMarkedAsCompleted)
bool get isFinished; // computed based on the fact that all the exercises in this step are completed
// == step.exercises.all.status === finished
@m-radzikowski
m-radzikowski / script-template.sh
Last active August 18, 2024 12:49
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@paolocarrasco
paolocarrasco / README.md
Last active September 22, 2024 17:51
How to understand the `gpg failed to sign the data` problem in git

Problem

You have installed GPG, then tried to commit and suddenly you see this error message after it:

error: gpg failed to sign the data
fatal: failed to write commit object

Debug

@topheman
topheman / git-notes.md
Created June 29, 2015 17:39
Git notes cheat sheet
@willurd
willurd / web-servers.md
Last active September 21, 2024 09:18
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000