Skip to content

Instantly share code, notes, and snippets.

View LearnGoIn5mins.md
View samizdat-shell-help.bash
#!/bin/bash
###
### my-script — does one thing well
###
### Usage:
### my-script <input> <output>
###
### Options:
### <input> Input file to read.
### <output> Output file to write. Use '-' for stdout.
View LetsDestroyC.md

Let's Destroy C

I have a pet project I work on, every now and then. CNoEvil.

The concept is simple enough.

What if, for a moment, we forgot all the rules we know. That we ignore every good idea, and accept all the terrible ones. That nothing is off limits. Can we turn C into a new language? Can we do what Lisp and Forth let the over-eager programmer do, but in C?


@munificent
munificent / generate.c
Last active Jun 7, 2021
A random dungeon generator that fits on a business card
View generate.c
#include <time.h> // Robert Nystrom
#include <stdio.h> // @munificentbob
#include <stdlib.h> // for Ginny
#define r return // 2008-2019
#define l(a, b, c, d) for (i y=a;y\
<b; y++) for (int x = c; x < d; x++)
typedef int i;const i H=40;const i W
=80;i m[40][80];i g(i x){r rand()%x;
}void cave(i s){i w=g(10)+5;i h=g(6)
+3;i t=g(W-w-2)+1;i u=g(H-h-2)+1;l(u
@johnhw
johnhw / umap_sparse.py
Last active Jul 14, 2021
1 million prime UMAP layout
View umap_sparse.py
### JHW 2018
import numpy as np
import umap
# This code from the excellent module at:
# https://stackoverflow.com/questions/4643647/fast-prime-factorization-module
import random
@Ryanb58
Ryanb58 / install.md
Last active Jul 28, 2021
How to install telnet into a alpine docker container. This is useful when using the celery remote debugger in a dev environment.
View install.md
>>> docker exec -it CONTAINERID /bin/sh
/app # telnet
/bin/sh: telnet: not found

/app # apk update
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
v3.7.0-243-gf26e75a186 [http://dl-cdn.alpinelinux.org/alpine/v3.7/main]
v3.7.0-229-g087f28e29d [http://dl-cdn.alpinelinux.org/alpine/v3.7/community]
@cecilemuller
cecilemuller / 2019-https-localhost.md
Last active Aug 2, 2021
How to create an HTTPS certificate for localhost domains
View 2019-https-localhost.md

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).

@berkedel
berkedel / flow-error-icu4c-not-loaded.md
Created Apr 4, 2018
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.60.dylib
View flow-error-icu4c-not-loaded.md

How to solve dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.60.dylib

brew uninstall --ignore-dependencies node icu4c
brew install node
@iodic
iodic / list-changes-between-branches.sh
Created Mar 28, 2018
Show a list of commit differences between git branches
View list-changes-between-branches.sh
git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative master..develop
@rupert
rupert / Dockerfile
Created Feb 9, 2018
pyflame Dockerfile
View Dockerfile
FROM python:3.6-stretch
RUN apt-get update \
&& apt-get -y install autoconf automake autotools-dev g++ pkg-config libtool make unzip
RUN cd /tmp && \
wget -O pyflame-master.zip https://github.com/uber/pyflame/archive/master.zip \
&& unzip pyflame-master.zip \
&& cd pyflame-master \
&& ./autogen.sh \