Skip to content

Instantly share code, notes, and snippets.

View orangeagain's full-sized avatar

orangeagain

View GitHub Profile
@gtors
gtors / sketch.c
Last active December 25, 2024 08:37
NFC 3ka
//Access Control Reader based on ApplePay (EMV) and Troyka cards
#include <Adafruit_PN532.h>
// If using the breakout with SPI, define the pins for SPI communication.
#define PN532_SCK (2)
#define PN532_MOSI (3)
#define PN532_SS (4)
#define PN532_MISO (5)
// Use this line for a breakout with a software SPI connection (recommended):
@mattatz
mattatz / Matrix.hlsl
Last active October 22, 2025 07:39
Matrix operations for HLSL
#ifndef __MATRIX_INCLUDED__
#define __MATRIX_INCLUDED__
#define IDENTITY_MATRIX float4x4(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)
float4x4 inverse(float4x4 m) {
float n11 = m[0][0], n12 = m[1][0], n13 = m[2][0], n14 = m[3][0];
float n21 = m[0][1], n22 = m[1][1], n23 = m[2][1], n24 = m[3][1];
float n31 = m[0][2], n32 = m[1][2], n33 = m[2][2], n34 = m[3][2];
float n41 = m[0][3], n42 = m[1][3], n43 = m[2][3], n44 = m[3][3];
@rushilgupta
rushilgupta / GoConcurrency.md
Last active May 9, 2025 10:20
Concurrency in golang and a mini Load-balancer

INTRO

Concurrency is a domain I have wanted to explore for a long time because the locks and the race conditions have always intimidated me. I recall somebody suggesting concurrency patterns in golang because they said "you share the data and not the variables".

Amused by that, I searched for "concurrency in golang" and bumped into this awesome slide by Rob Pike: https://talks.golang.org/2012/waza.slide#1 which does a great job of explaining channels, concurrency patterns and a mini-architecture of load-balancer (also explains the above one-liner).

Let's dig in:

Goroutines

@bobmoff
bobmoff / Unity Server in Docker Container
Last active September 24, 2022 15:55
Running Unity headless unix build in Docker container on Docker Cloud
@FlexMonkey
FlexMonkey / gist:1065a5272cb8bd7c3a904cd677f258d2
Created April 1, 2016 04:05
Bresenham's Line Algorithm for Metal Compute Shader
void drawLine(texture2d<float, access::write> targetTexture, uint2 start, uint2 end);
void drawLine(texture2d<float, access::write> targetTexture, uint2 start, uint2 end)
{
int x = int(start.x);
int y = int(start.y);
int dx = abs(x - int(end.x));
int dy = abs(y - int(end.y));
@adamawolf
adamawolf / Apple_mobile_device_types.txt
Last active December 9, 2025 15:13
List of Apple's mobile device codes types a.k.a. machine ids (e.g. `iPhone1,1`, `Watch1,1`, etc.) and their matching product names
i386 : iPhone Simulator
x86_64 : iPhone Simulator
arm64 : iPhone Simulator
iPhone1,1 : iPhone
iPhone1,2 : iPhone 3G
iPhone2,1 : iPhone 3GS
iPhone3,1 : iPhone 4
iPhone3,2 : iPhone 4 GSM Rev A
iPhone3,3 : iPhone 4 CDMA
iPhone4,1 : iPhone 4S