Skip to content

Instantly share code, notes, and snippets.

@purplejacket
purplejacket / nibbles.c
Created November 8, 2023 00:56
movfuscator/validation/nibbles.c from https://github.com/Battelle/movfuscator -- needs the ncurses library to compile
#include <stdlib.h>
#define _Bool unsigned int /* lcc doesn't define this */
#include <ncurses.h>
#define MAX_LENGTH 100
typedef enum { NONE, UP, DOWN, LEFT, RIGHT } dir_t;
typedef struct {
int x, y;
@purplejacket
purplejacket / sort2.g0.s
Created June 16, 2023 23:33
zig cc -S -g0 sort2.c -o sort2.g0.s
.section __TEXT,__text,regular,pure_instructions
.build_version macos, 13, 1 sdk_version 13, 1
.globl _variable_sort_2 ## -- Begin function variable_sort_2
.p2align 4, 0x90
_variable_sort_2: ## @variable_sort_2
.cfi_startproc
## %bb.0:
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset %rbp, -16
@purplejacket
purplejacket / sort2.c
Created June 14, 2023 03:44
sort2.c — see for example "Faster sorting algorithms discovered using deep reinforcement learning" — https://www.nature.com/articles/s41586-023-06004-9
void variable_sort_2(int length, int *a) {
if(length == 2){
if(a[0] > a[1]){
int temp = a[0];
a[0] = a[1];
a[1] = temp;
}
}
}
@purplejacket
purplejacket / sort2.gcc.s
Created June 14, 2023 03:41
gcc -S sort2.c -o sort2.gcc.s
.section __TEXT,__text,regular,pure_instructions
.build_version macos, 13, 0 sdk_version 13, 1
.globl _variable_sort_2 ## -- Begin function variable_sort_2
.p2align 4, 0x90
_variable_sort_2: ## @variable_sort_2
.cfi_startproc
## %bb.0:
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset %rbp, -16
@purplejacket
purplejacket / sort2.zig_cc.s
Last active June 14, 2023 03:40
zig cc -S sort2.c -o sort2.zig_cc.s
.section __TEXT,__text,regular,pure_instructions
.build_version macos, 13, 1 sdk_version 13, 1
.file 1 "/tmp" "sort2.c"
.globl _variable_sort_2 ## -- Begin function variable_sort_2
.p2align 4, 0x90
_variable_sort_2: ## @variable_sort_2
Lfunc_begin0:
.loc 1 1 0 ## sort2.c:1:0
.cfi_startproc
## %bb.0:
@purplejacket
purplejacket / umax4_8.c
Created December 21, 2021 19:57
MicroMax chess version 4.8 -- original source: https://home.hccnet.nl/h.g.muller/umax4_8.c
/***************************************************************************/
/* micro-Max, */
/* A chess program smaller than 2KB (of non-blank source), by H.G. Muller */
/***************************************************************************/
/* version 4.8 (1953 characters) features: */
/* - recursive negamax search */
/* - all-capture MVV/LVA quiescence search */
/* - (internal) iterative deepening */
/* - best-move-first 'sorting' */
/* - a hash table storing score and best move */
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/p5.js"></script>
<ul>
Screeps
<ul>
<li>Harvesters </li>
<li>Upgraders</li>
<li>Builders</li>
</ul>
@purplejacket
purplejacket / your_phone_is_listening_to_you_ultrasonic_cross-device_tracking.txt
Last active April 4, 2022 11:37
Your phone is listening to you - ultrasonic cross-device tracking
Original video: https://www.youtube.com/watch?v=j1FfVK6sj4I
By: The Hated One
Ultrasonic cross-device tracking:
https://intellisec.de/pubs/2016-batmobile.pdf
https://techcrunch.com/2014/07/24/silverpush-audio-beacons/
https://www.wired.com/2016/11/block-ultrasonic-signals-didnt-know-tracking/
https://thehackernews.com/2017/05/ultrasonic-tracking-signals-apps.html
https://www.cbsnews.com/news/google-removes-apps-that-use-ultrasonic-frequencies-to-track-users/
https://www.zdnet.com/article/hundreds-of-apps-are-using-ultrasonic-sounds-to-track-your-ad-habits/
@purplejacket
purplejacket / mu_puzzle.rb
Created July 1, 2020 05:29
MU puzzle -- from Gödel Escher Bach by Douglas R. Hofstadter -- https://en.wikipedia.org/wiki/MU_puzzle
# MU puzzle
# From Gödel Escher Bach by Douglas R. Hofstadter
# https://en.wikipedia.org/wiki/MU_puzzle
# Nr. Formal rule Informal explanation Example
# -----------------------------------------------------------------------------------
# 1. xI → xIU Add a U to the end of any string ending in I MI to MIU
# 2. Mx → Mxx Double the string after the M MIU to MIUIU
# 3. xIIIy → xUy Replace any III with a U MUIIIU to MUUU
# 4. xUUy → xy Remove any UU MUUU to MU
@purplejacket
purplejacket / Bosco_So_how_to_give_a_talk.md
Last active April 4, 2019 15:20
How to give a talk -- by Bosco So

How to Give a Talk

Treat it like a Meal

  • Appetizer - tell your audience what you’ll be talking about
  • Entree - the actual content
  • Dessert - summarize
  • Take away - something the audience can go home with

How do you get attention?

  • Ask a question