Skip to content

Instantly share code, notes, and snippets.

View gheja's full-sized avatar
🤘

Gabor Heja gheja

🤘
View GitHub Profile
@thygrrr
thygrrr / CameraZoomAndPan.gd
Last active October 19, 2025 01:11
Godot Zoom and Pan, smooth & cursor-centric Camera2D motion
# SPDX-License-Identifier: Unlicense or CC0
extends Node2D
# Smooth panning and precise zooming for Camera2D
# Usage: This script may be placed on a child node
# of a Camera2D or on a Camera2D itself.
# Suggestion: Change and/or set up the three Input Actions,
# otherwise the mouse will fall back to hard-wired mouse
# buttons and you will miss out on alternative bindings,
# deadzones, and other nice things from the project InputMap.
RSA Private-Key: (6969 bit, 69 primes)
modulus:
01:01:57:5a:5e:73:6f:8f:02:77:e3:27:6e:c6:bd:
97:cf:32:95:de:59:a7:32:7e:64:84:e3:3e:e8:17:
f3:8c:07:5c:1e:74:7a:40:33:86:7b:45:bc:e0:b6:
c8:6c:e3:fa:5a:1c:65:18:1a:5c:fc:3c:8a:c4:f5:
6f:63:60:32:cc:cd:03:b5:c9:54:29:d5:b2:c1:24:
54:81:0b:f4:40:53:84:e5:14:2c:58:70:98:7f:36:
6b:ef:df:13:5e:8f:07:05:f1:42:25:cf:30:82:94:
9a:11:df:49:9a:76:51:ad:6e:d7:46:2d:b8:ed:39:
@marcan
marcan / rpi_cam_auth.py
Created January 25, 2019 07:48
Raspberry Pi Camera V2 DRM authentication example
import hmac, hashlib
# Data from I²C trace at https://hackaday.io/project/19480-raspberry-pi-camera-v21-reversed/log/52547-i2c-logic-analyzer-trace
# Secret key from VideoCore blob
# serial[8], serial[7:4], serial[3:0]
serial = bytes.fromhex("EE8C196D8301230B59")
# rPi -> camera random number
numIn = bytes.fromhex("5805F3C898C3133154498E082F2E703516F2DBD1")
from math import *
# a performant solution would store a prefix sum of line lengths to
# a sidechannel and then use that to do a bsearch; on the GPU,
# you'd do a sum tree / histopyramid as a preprocessing step
def find_point(points, d):
d = d
for i in range(1, len(points)):
x0,y0 = points[i-1]
x1,y1 = points[i]
@stecman
stecman / Makefile
Last active September 24, 2025 01:03
DS18B20 1-Wire implementation for Atmel AVR
DEVICE = atmega328p
CLOCK = 16000000
PROGRAMMER = -c arduino -P /dev/ttyUSB0 -b57600
AVRDUDE = avrdude $(PROGRAMMER) -p $(DEVICE)
SOURCES = $(shell find . -name '*.c')
OBJECTS = $(SOURCES:.c=.o)
# Automatic dependency resolution
@harshavardhana
harshavardhana / nginx-minio-static.md
Last active September 29, 2025 00:12 — forked from koolhead17/gist:4b8dd8d95ec86368634693cf9ad9391c
How to configure static website using Nginx with MinIO ?

How to configure static website using Nginx with MinIO ?

1. Install nginx

2. Install minio

3. Install mc client

4. Create a bucket:

$ mc mb myminio/static
Bucket created successfully ‘myminio/static’.
@xem
xem / readme.md
Last active December 7, 2025 16:33
Maths & trigonometry cheat sheet for 2D & 3D games

Conventions

  • A = [xA, yA] is a point on the 2D plane. Same for B, C, ...
  • lengths are in any unit (ex: pixels)
  • code snippets are in JavaScript

Degrees to radians

angleRad = angleDeg * Math.PI / 180;

@subzey
subzey / gist:b18c482922cd17693d65
Last active November 1, 2025 17:50
Few Tricks on Compressing Js13k Entry

Few Tricks on Compressing Js13k Entry

Most important detail: in js13k entry 13k stands for zipped entry size. And this detail makes js13k differ from other code golfing compos.

Last year winner entry uncompressed size was about 70k. 70 kilobytes! In js1k you have a month to minify 1k, so how much time would it take to minify 70k? Nope, you have only 1 month. So it's very unlikely one will manually golf the entry. And this is the other thing that makes js13k special: no hardcore manual "hell yeah I've stripped one byte!" golfing.

@subzey
subzey / dson.js
Last active August 29, 2015 14:02
DSON shim
var DSON = DSON || {
parse: function(v) {
return JSON.parse(v.replace(/"(\\"|[^"])*"|[a-z]+/gi, function(v) {
return {
such: '{',
wow: '}',
is: ':',
so: '[',
many: ']',
next: ',',