Skip to content

Instantly share code, notes, and snippets.

View VadimGush's full-sized avatar
🔍
Looking for a job

Vadim Gush VadimGush

🔍
Looking for a job
View GitHub Profile
@april
april / arena-macos-fixes.sh
Last active May 29, 2024 23:24
Fixes Magic Arena's broken full screen implementation on macOS
# this forces Arena into full screen mode on startup, set back to 3 to reset
# note that if you go into the Arena "Graphics" preference panel, it will reset all of these
# and you will need to run these commands again
defaults write com.wizards.mtga "Screenmanager Fullscreen mode" -integer 0
defaults write com.wizards.mtga "Screenmanager Resolution Use Native" -integer 0
# you can also replace the long complicated integer bit with any other scaled 16:9
# resolution your system supports.
# to find the scaled resolutions, go to System Preferences --> Display and then
# divide the width by 16 and multiple by 9. on my personal system this ends up
@simonrenger
simonrenger / memoy_managment_cpp_resource_list.md
Last active May 9, 2024 08:27
C++ Memory Management Resource List
@mepcotterell
mepcotterell / README.md
Last active July 27, 2022 02:09
Implementing a Semaphore

Implementing a Semaphore

Use the following commands to compile and link the examples:

$ gcc -std=c17 -pedantic-errors -O0 -g -S sem.c
$ as --gstabs -o sem.o sem.s 
$ gcc -o sem sem.o -lpthread

This implementation makes use of the C11 Atomic Operations Library.

@mepcotterell
mepcotterell / README.md
Last active March 5, 2023 17:06
Implementing a Mutex

Implementing a Mutex

Use the following commands to compile and link the examples:

$ gcc -std=c17 -pedantic-errors -O0 -g -S mutex.c
$ as --gstabs -o mutex.o mutex.s 
$ gcc -o mutex mutex.o -lpthread

This implementation makes use of the C11 Atomic Operations Library.

window.onwheel = function (e) {
e.preventDefault();
if (e.ctrlKey) {
// Your zoom/scale factor
scale -= e.deltaY * 0.01;
} else {
// Your trackpad X and Y positions
posX -= e.deltaX * 2;
posY -= e.deltaY * 2;
@thiloplanz
thiloplanz / Zero_knowledge_db.md
Last active July 15, 2024 11:26
Zero-knowledge databases

Zero knowledge databases

The idea

The idea is to provide a database as a service to end users in such a way that no one except the user herself can access the data, not even the hosting provider or the database administrator.

Advantages

  • A privacy- and/or security-conscious user will have more trust in such a setup.
  • The service provider cannot be coerced to release the data they were trusted with, and he cannot be held responsible for the content he is storing.
@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

@jboner
jboner / latency.txt
Last active July 17, 2024 03:12
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD