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 January 27, 2025 07:00
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 February 10, 2025 15:41
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
@kjantzer
kjantzer / previous-git-tag.sh
Created March 2, 2015 20:01
Get Previous Git Tag (the one before the latest tag)
# http://stackoverflow.com/a/28818420/484780
git describe --abbrev=0 --tags `git rev-list --tags --skip=1 --max-count=1`
@willurd
willurd / web-servers.md
Last active February 28, 2025 17:17
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