Skip to content

Instantly share code, notes, and snippets.

View avivbeeri's full-sized avatar

Aviv Beeri avivbeeri

View GitHub Profile
@atc1441
atc1441 / UpdateProtocolDafit.txt
Last active September 10, 2023 21:32
DaFit App Update Protocol manual
Basic Manual for DaFit Fitness Tracker firmware update protocol, works for nearly any nRF52832 tracker from Company DaFit
The minimum size of update file is 0x10000(can be filled with garbage to get to size) and the maximum size is 0x2F000
the update will first get stored onto the external flash at position 0x3D1000 by the stock firmware(not by the bootloader)
the size of the update will get stored at 0x3D0000 on external flash with 4 bytes uint32_t
when bootloader gets activated it will copy the update from external flash to 0x23000 of the nRF52 internal flash.
Connect to device,
@NoelFB
NoelFB / Aseprite.cs
Last active May 10, 2024 01:44
ugly C# .ase (aseprite) parser
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Text;
// File Format:
// https://github.com/aseprite/aseprite/blob/master/docs/ase-file-specs.md
// Note: I didn't test with with Indexed or Grayscale colors
@370417
370417 / shadowcasting.js
Created April 24, 2016 15:10
Symmetric recursive shadowcasting
/**
* Recursive shadowcasting algorithm.
* This algorithm creates a field of view centered around (x, y).
* Opaque tiles are treated as if they have beveled edges.
* Transparent tiles are visible only if their center is visible, so the
* algorithm is symmetric.
* @param cx - x coordinate of center
* @param cy - y coordinate of center
* @param transparent - function that takes (x, y) as arguments and returns the transparency of that tile
* @param reveal - callback function that reveals the tile at (x, y)
@blixt
blixt / prng.js
Last active January 14, 2024 07:01
A very simple, seedable JavaScript PRNG. NOTE: Please read comments on why this is not a good choice.
// NOTICE 2020-04-18
// Please see the comments below about why this is not a great PRNG.
// Read summary by @bryc here:
// https://github.com/bryc/code/blob/master/jshash/PRNGs.md
// Have a look at js-arbit which uses Alea:
// https://github.com/blixt/js-arbit
/**
@nathan-osman
nathan-osman / CMakeLists.txt
Last active April 2, 2024 21:27
Generates a self-signed x509 certificate using OpenSSL.
# A simple CMake script for building the application.
cmake_minimum_required(VERSION 2.8)
project(create-x509)
# Our only dependency is OpenSSL
find_package(OpenSSL REQUIRED)
include_directories(${OPENSSL_INCLUDE_DIR})
add_executable(create-x509 create-x509.cpp)
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
struct Triangle {
public int p1;
public int p2;
public int p3;
public Triangle(int point1, int point2, int point3) {
@armornick
armornick / playwav.c
Created August 24, 2012 07:31
Play a sound with SDL2 (no SDL_Mixer)
#include <SDL2/SDL.h>
#define MUS_PATH "Roland-GR-1-Trumpet-C5.wav"
// prototype for our audio callback
// see the implementation for more information
void my_audio_callback(void *userdata, Uint8 *stream, int len);
// variable declarations
static Uint8 *audio_pos; // global pointer to the audio buffer to be played