Skip to content

Instantly share code, notes, and snippets.

View jk-gan's full-sized avatar
🔺
Shooting rays at triangles

Gan Jun Kai jk-gan

🔺
Shooting rays at triangles
View GitHub Profile
@jk-gan
jk-gan / latency.markdown
Created January 20, 2024 13:36 — forked from hellerbarde/latency.markdown
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

@jk-gan
jk-gan / custom_game_engines_small_study.md
Created September 24, 2023 01:24 — forked from raysan5/custom_game_engines_small_study.md
A small state-of-the-art study on custom engines

CUSTOM GAME ENGINES: A Small Study

a_plague_tale

A couple of weeks ago I played (and finished) A Plague Tale, a game by Asobo Studio. I was really captivated by the game, not only by the beautiful graphics but also by the story and the locations in the game. I decided to investigate a bit about the game tech and I was surprised to see it was developed with a custom engine by a relatively small studio. I know there are some companies using custom engines but it's very difficult to find a detailed market study with that kind of information curated and updated. So this article.

Nowadays lots of companies choose engines like Unreal or Unity for their games (or that's what lot of people think) because d

@jk-gan
jk-gan / headless-chrome-ec2.md
Created April 11, 2023 12:43 — forked from jeanlescure/headless-chrome-ec2.md
How to setup an EC2 instance to run Chrome Headless for usage with Puppeteer

Chrome Headless on EC2

For puppeteer usage

How to setup an EC2 instance to run Chrome Headless for usage with Puppeteer

1. Spin up ubuntu EC2 instance and ssh into it

ssh [email protected]
@jk-gan
jk-gan / Simulation_Projection.md
Created April 19, 2022 13:25 — forked from vassvik/Simulation_Projection.md
Realtime Fluid Simulation: Projection

Realtime Fluid Simulation: Projection

The core of most real-time fluid simulators, like the one in EmberGen, are based on the "Stable Fluids" algorithm by Jos Stam, which to my knowledge was first presented at SIGGRAPH '99. This is a post about one part of this algorithm that's often underestimated: Projection

MG4_F32.mp4

Stable Fluids

The Stable Fluids algorithm solves a subset of the famous "Navier Stokes equations", which describe how fluids interact and move. In particular, it typically solves what's called the "incompressible Euler equations", where viscous forces are often ignored.

TypeScript 9 hrs 20 mins ███████████████████▍░ 92.8%
JSON 21 mins ▊░░░░░░░░░░░░░░░░░░░░ 3.6%
Elixir 13 mins ▍░░░░░░░░░░░░░░░░░░░░ 2.3%
Other 8 mins ▎░░░░░░░░░░░░░░░░░░░░ 1.3%
@jk-gan
jk-gan / crlf2lf.sh
Created May 26, 2017 09:34 — forked from plwai/crlf2lf.sh
Simple script to change CRLF to LF.
#!/bin/bash
# Simple script to change crlf to lf.
# To start: Put in gitignore folder and run.
# Note: ^.* files are not supported
ignore_name=()
ignore_path=()
ignore_extension=()
ignore_extension+=('.sh')
@jk-gan
jk-gan / random.md
Last active March 30, 2017 11:03
Using regex to remove all extra comments in Gemfile

Note

Use ^#.*\n to select all the extra comments in Gemfile

Screen Shot

# Creates a model and controller, then adds a resource route to your routes.rb file.
rails g resource <attribute>:<type> <attribute>:<type>
# Just like rails g scaffold, but doesn't create the model.
rails g scaffold_controller <name>
# Creates a coffeescript/javascript and corresponding (s)css file.
rails g assets <name>
# Creates a jbuilder file