Skip to content

Instantly share code, notes, and snippets.

View HIHIQY1's full-sized avatar
🤔

Qy HIHIQY1

🤔
View GitHub Profile
#include <stdio.h>
#include <stdint.h>
// Philips Sonicare NFC Head Password calculation by @atc1441 Video manual: https://www.youtube.com/watch?v=EPytrn8i8sc
uint16_t CRC16(uint16_t crc, uint8_t *buffer, int len) // Default CRC16 Algo
{
while(len--)
{
crc ^= *buffer++ << 8;
int bits = 0;
do
@marcan
marcan / m1cat.c
Last active October 26, 2023 15:42
m1cat: a PoC for the M1RACLES covert channel vulnerability in the Apple M1
/*
* m1cat: a proof of concept for the M1RACLES vulnerability in the Apple M1.
*
* This program implements a covert channel that can be used to transmit data
* between two processes when run on the Apple Silicon "M1" CPUs.
*
* The channel is slightly lossy due to (presumably) the scheduler sometimes
* scheduling us on the wrong CPU cluster, so this PoC sends every byte twice
* together with some metadata/framing bits, which is usually good enough.
* A better approach would be to use proper FEC or something like that.
@furudean
furudean / checkDigitEAN13.js
Last active November 8, 2023 14:33
Generate EAN13 check digit
/**
* Generates a check digit from a partial EAN13.
*
* https://www.gs1.org/services/how-calculate-check-digit-manually
*
* @param {string} barcode - 12 digit EAN13 barcode without the check digit
*/
function checkDigitEAN13(barcode) {
const sum = barcode.split('')
.map((n, i) => n * (i % 2 ? 3 : 1)) // alternate between multiplying with 3 and 1
@tommy-mor
tommy-mor / video.py
Last active January 3, 2024 21:59
not good code stay away
from moviepy.editor import *
import numpy as np
clip = VideoFileClip("hams.mkv")
import sounddevice as sd
import soundfile as sf
from queue import Queue
from collections import OrderedDict
import pprint
pp = pprint.PrettyPrinter(indent=4)
print('started')
@steven2358
steven2358 / ffmpeg.md
Last active March 26, 2024 17:50
FFmpeg cheat sheet
@Joeywp
Joeywp / Example.js
Last active March 10, 2024 02:33
A very basic RCT3 general archive file reader that stores it's data in a way that makes it possible to edit and eventually even write back a general archive file. It depends on the JavaScript library jDataView.js
$(document).on('drop', function (e) {
e.stopPropagation();
e.preventDefault();
$("body").removeClass("drop");
var files = e.originalEvent.dataTransfer.files;
//console.log(files[0]);
new BinaryLoader(files[0], function (archive) {
console.log(archive);
if (archive != null) {
@jonathantneal
jonathantneal / README.md
Last active February 8, 2024 10:53
Nearest Normal Ratio Calculator

Nearest Normal Aspect Ratio

This function returns the nearest aspect ratio of a width and height within a limited range of possible aspect ratios.

In other words, while 649x360 technically has an aspect ratio of 649:360, it’s often useful to know that the nearest normal aspect ratio is actually 9:5 (648x360).

nearestNormalAspectRatio(width, height, [side], [maxWidth], [maxHeight])
@gre
gre / easing.js
Last active March 19, 2024 01:19
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* This work is free. You can redistribute it and/or modify it under the
* terms of the Do What The Fuck You Want To Public License, Version 2,
* as published by Sam Hocevar. See the COPYING file for more details.
*/
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {