Skip to content

Instantly share code, notes, and snippets.

@TheGreatSageEqualToHeaven
TheGreatSageEqualToHeaven / LuauOptimizeLevel.lua
Created March 28, 2024 01:34
Getting the Luau optimize level at runtime safely
local function getOptimizeLevel()
local function dupclosure()
return function() end
end
local O0 = dupclosure() ~= dupclosure()
local function inlinefunction()
return debug.info(1, "f")
end
@beginor
beginor / snowflake-id.sql
Last active May 9, 2024 15:28
Twitter Snowflake ID for PostgreSQL
CREATE SEQUENCE public.global_id_seq;
ALTER SEQUENCE public.global_id_seq OWNER TO postgres;
CREATE OR REPLACE FUNCTION public.id_generator()
RETURNS bigint
LANGUAGE 'plpgsql'
AS $BODY$
DECLARE
our_epoch bigint := 1314220021721;
seq_id bigint;
@chrisdone
chrisdone / typing.md
Last active May 9, 2024 15:27
Typing Haskell in Haskell

Typing Haskell in Haskell

MARK P. JONES

Pacific Software Research Center

Department of Computer Science and Engineering

Oregon Graduate Institute of Science and Technology

@bureyburey
bureyburey / split-async-storage
Last active May 9, 2024 15:24
SplitAsyncStorage
/**
* custom wrapper for AsyncStorage that splits the data of a given storageKey to smaller chunks
* a large object with multiple keys will be spreaded to all the keys in the first level of the main object
* { data: { key1: value1, key2: value2, ...} }
* will be saved as key1 => value1, key2 => value2, ...
* this approach is intended to prevent the limitation of 2MB per value of AsyncStorage by spreading the values across the storage
*
* basic usage:
*
* import AsyncStorage from '@react-native-community/async-storage';

MIFARE Classic

Here are the steps to follow in order to read your cards. Your goal is to find as many keys as possible. The keys unlock sections of your card for the Flipper to read them - you must have a card. Once you read enough sections, you can use an emulated or cloned card at the original card reader to unlock it (sometimes even without finding all of the keys!).

Reading the card

Steps:

  1. Dictionary attack: Try to scan your MIFARE Classic card with NFC -> Read. It will try a dictionary attack of default keys to unlock your card, as well as any keys you may have found through other methods. Do not interrupt the dictionary attack, it may take a while! If it finds 32/32 keys (or 80/80) with 16/16 sectors (or 40/40), congratulations and proceed to "Emulation". If not, continue to step 2.
  2. Mfkey32 attack (): If you have only a few keys found or no keys found, you can get mor
@hamelsmu
hamelsmu / webhook-circleback.py
Created April 25, 2024 04:59
Generate a project proposal automatically from a meeting transcript
from fastapi import Request, HTTPException
from pydantic import BaseModel, BaseModel, HttpUrl
from modal import Secret, App, web_endpoint, Image
from typing import Optional, List
from example import proposal
import os
app = App(name="circleback", image=Image.debian_slim().pip_install("openai", "pydantic", "fastapi"))
class Attendee(BaseModel):
@pknowledge
pknowledge / docker-compose.yaml
Created February 26, 2024 16:36
Run Microsoft Azure SQL Edge using docker compose
version: '3.8'
services:
sql:
image: mcr.microsoft.com/azure-sql-edge
container_name: sql
ports:
- "1433:1433"
environment:
ACCEPT_EULA: "1"
@Hirrolot
Hirrolot / cps-eval.ml
Created March 24, 2023 10:34
A simple CPS evaluation as in "Compiling with Continuations", Andrew W. Appel
type cps_var =
(* Taken from the lambda term during CPS conversion. *)
| CLamVar of string
(* Generated uniquely during CPS conversion. *)
| CGenVar of int
type cps_term =
| CFix of (cps_var * cps_var list * cps_term) list * cps_term
| CAppl of cps_var * cps_var list
| CRecord of cps_var list * binder
@GrayHatGuy
GrayHatGuy / iridium-sdr.md
Last active May 9, 2024 15:19
Iridium satellite cheat sheet for hackrf SDR capture using gr-iridium iridium-toolkit and iridium live

Description

This details how to capture voice text and rings associated with iridium satellite rebroadcasts of the Aircraft Communications Addressing and Report System (ACARS)

Prerequisites:

  • Start installation in home directory preferred
    cd ~
    
  • Install the following repos preferably from source or using apt in home directory or /usr/scr/:
@Hirrolot
Hirrolot / a-preface.md
Last active May 9, 2024 15:19
A complete implementation of the positive supercompiler from "A Roadmap to Metacomputation by Supercompilation" by Gluck & Sorensen

Supercompilation is a deep program transformation technique due to V. F. Turchin, a prominent computer scientist, cybernetician, physicist, and Soviet dissident. He described the concept as follows [^supercompiler-concept]:

A supercompiler is a program transformer of a certain type. The usual way of thinking about program transformation is in terms of some set of rules which preserve the functional meaning of the program, and a step-by-step application of these rules to the initial program. ... The concept of a supercompiler is a product of cybernetic thinking. A program is seen as a machine. To make sense of it, one must observe its operation. So a supercompiler does not transform the program by steps; it controls and observes (SUPERvises) the running of the machine that is represented by the program; let us call this machine M1. In observing the operation of