Skip to content

Instantly share code, notes, and snippets.

@kruhft
kruhft / txtelite.c
Created April 10, 2012 00:48
txtelite port compilable on unix : gcc -o txtelite txtelite.c -lm
/* txtelite.c 1.4 */
/* Textual version of Elite trading (C implementation) */
/* Converted by Ian Bell from 6502 Elite sources.
Original 6502 Elite by Ian Bell & David Braben. */
/* Quick port to Linux/Unix systems by Burton Samograd <kruhft@gmail.com> */
/* Source: http://www.iancgbell.clara.net/elite/text/index.htm */
/* ----------------------------------------------------------------------
The nature of basic mechanisms used to generate the Elite socio-economic
universe are now widely known. A competant games programmer should be able to
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 21, 2024 16:06
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@XVilka
XVilka / TrueColour.md
Last active July 9, 2024 23:28
True Colour (16 million colours) support in various terminal applications and terminals

THIS GIST WAS MOVED TO TERMSTANDARD/COLORS REPOSITORY.

PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!

@reagent
reagent / .gitignore
Last active November 8, 2023 08:53
Curses Windowing Example
demo
*.swp
@chaitanyagupta
chaitanyagupta / re-sign-ios-app.md
Last active October 20, 2023 08:28
How to re-sign an iOS app with another developer account

WARNING These steps are probably out dated and will not work.

To re-sign an iOS app with another developer account, ensure that the following are in place first.

  1. Distribution certificate of the other developer account
  2. A provisioning profile from the other developer account

Note that the Apple requires bundle IDs to be globally unique, even across accounts. So a bundle ID i.e. CFBundleIdentifier from one account can't be used in a different account, even though the team id/prefix would be different.

Ensure that the new distribution certificate is in your keychain and the new provisioning profile on your disk.

@asmaloney
asmaloney / Packaging_Example.sh
Last active September 14, 2023 14:45
This is an example of script to package up and create a DMG for a Mac OS X app. Details may be found here: http://asmaloney.com/2013/07/howto/packaging-a-mac-os-x-application-using-a-dmg/
#!/bin/bash
# by Andy Maloney
# http://asmaloney.com/2013/07/howto/packaging-a-mac-os-x-application-using-a-dmg/
# make sure we are in the correct dir when we double-click a .command file
dir=${0%/*}
if [ -d "$dir" ]; then
cd "$dir"
fi
var CELL_SIZE = 30,
MAP_SIZE = 20,
VISUAL_FRAME_COUNT = 10,
INFINITY = Infinity,
MAP = [
[2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
@JohnnyonFlame
JohnnyonFlame / raycurse.c
Last active April 6, 2022 20:23
A small raycasting prototype in C using the pdcurses library.
#include <stdio.h>
#include <curses.h>
#include <math.h>
float pos[2] = {(6 * 32) + 16.f, (6 * 32) + 16.f};
int dir = 0;
int is3d = 1;
char dungeon[17][17] =
{
@r-lyeh-archived
r-lyeh-archived / distance.cc
Created June 30, 2015 15:20
point-to-point distance algorithms survey
// point-to-point distance algorithms survey
// - rlyeh, public domain.
// possible output {
// manhattan_distance: 0.608632s. (result: 6)
// octagonal_distance: 0.651783s. (result: 3.52249)
// baptista_distance: 1.10458s. (result: 4.79492)
// baptista_distance_b: 1.09981s. (result: 4.64063)
// euclidean_distance: 1.25s. (result: 4.47214)
// euclidean_distance_fast: 1.03207s. (result: 4.5)