Skip to content

Instantly share code, notes, and snippets.

View cj1128's full-sized avatar

CJ cj1128

View GitHub Profile
@munificent
munificent / generate.c
Last active May 7, 2024 06:19
A random dungeon generator that fits on a business card
#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
@tsenart
tsenart / 00_go_output.txt
Last active October 31, 2018 03:21
Quantum effects
10/s: min: 454ns max: 5.341µs 0.50: 711ns 0.90: 1.042µs 0.95: 1.223µs 0.99: 4.173µs
50/s: min: 278ns max: 76.968µs 0.50: 768ns 0.90: 1.306µs 0.95: 2.956µs 0.99: 5.596µs
100/s: min: 193ns max: 41.241µs 0.50: 712ns 0.90: 1.136µs 0.95: 1.614µs 0.99: 4.393µs
500/s: min: 148ns max: 21.488µs 0.50: 721ns 0.90: 1.003µs 0.95: 1.086µs 0.99: 3.061µs
1000/s: min: 137ns max: 44.32µs 0.50: 735ns 0.90: 1.009µs 0.95: 1.069µs 0.99: 2.682µs
5000/s: min: 109ns max: 11.757µs 0.50: 348ns 0.90: 374ns 0.95: 398ns 0.99: 491ns
10000/s: min: 109ns max: 22.745µs 0.50: 348ns 0.90: 371ns 0.95: 384ns 0.99: 478ns
@steven2358
steven2358 / ffmpeg.md
Last active May 8, 2024 05:51
FFmpeg cheat sheet
@branneman
branneman / better-nodejs-require-paths.md
Last active April 27, 2024 04:16
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@willurd
willurd / web-servers.md
Last active May 8, 2024 18:19
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
/***********************************************************************
* connect.c -- Make socket connection using SOCKS4/5 and HTTP tunnel.
*
* Copyright (c) 2000-2006 Shun-ichi Goto
* Copyright (c) 2002, J. Grant (English Corrections)
* Copyright (c) 2010, Reini Urban (added realm to http_auth basic)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2