Skip to content

Instantly share code, notes, and snippets.

View DavidBuchanan314's full-sized avatar
🌍
Hack the planet!

David Buchanan DavidBuchanan314

🌍
Hack the planet!
View GitHub Profile
@chrisdone
chrisdone / gist:02e165a0004be33734ac2334f215380e
Last active May 26, 2024 13:57
Build and run minimal Linux / Busybox systems in Qemu

Common

export OPT=/opt
export BUILDS=/some/where/mini_linux
mkdir -p $BUILDS

Linux kernel

This file has been truncated, but you can view the full file.
#define UNLOADED_FILE 1
#include <idc.idc>
static main(void)
{
// set 'loading idc file' mode
set_inf_attr(INF_GENFLAGS, INFFL_LOADIDC|get_inf_attr(INF_GENFLAGS));
GenInfo(); // various settings
Segments(); // segmentation
Enums(); // enumerations
sc.killAutoHandle();
sc.getService("ns:am2", (hndle) => {
utils.log("got handle 0x" + hndle.toString(16));
// GetApplicationManagerInterface
var res = sc.ipcMsg(7996).data(0).sendTo(hndle).assertOk();
sc.withHandle(res.movedHandles[0], (amih) => {
utils.log("got handle 0x" + amih.toString(16));
// launch
@tott
tott / read-backlight.py
Created November 22, 2018 11:41
Read backlight for x230 / x330 taobao FHD mod
#!/usr/bin/env python
import sys
import array
import usb.core
import usb.util
import os
path = "/tmp/backlight-value"
# decimal vendor and product values
@justgerd
justgerd / 1_switchmemes.md
Last active September 25, 2019 15:26
ReSwitched #offtopic pins.

Accuracy of CTU simulating the Switch

Accuracy meme

Confused people

Switch to Linux distros

Accuracy of Mephisto emulating the Switch

Accuracy meme 2

Windows Update vs Switch Hacking

@knightsc
knightsc / hijack.c
Created February 26, 2019 21:20
Example of how to hijack a thread on macOS to run code in a remote process
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <unistd.h>
#include <mach/mach.h>
#include <mach/mach_vm.h>
#include <dlfcn.h>
#include <objc/runtime.h>
@enepomnyaschih
enepomnyaschih / base64.js
Last active March 6, 2024 23:45
https://www.npmjs.com/package/byte-base64 - Encode JS Uint8Array, simple array of bytes or native JS string to base64 and back
/*
MIT License
Copyright (c) 2020 Egor Nepomnyaschih
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@Treeki
Treeki / TurnipPrices.cpp
Last active May 27, 2024 15:18
AC:NH turnip price calculator
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
// munged from https://github.com/simontime/Resead
namespace sead
{
class Random
{
// Unscaled values for kOpsinAbsorbanceBias
const kB0 = 0.96723368009523958;
const kB1 = kB0;
const kB2 = kB0;
const kScale = 255.0;
const kScaleR = 1.0;
const kScaleG = 1.0;
const kInvScaleR = 1.0;
const kInvScaleG = 1.0;
@DavidBuchanan314
DavidBuchanan314 / life.c
Last active August 9, 2023 23:12
Yet another reformatting of my tiny game of life implementation. Valid ANSI C with no (default) compiler warnings or UB
#define F\
for(i=l;i\
<l*4; i++)
main(){int
i,j,w=512,
n,l=w*w,o[
]={~w,-w,-
w+1,-1,1,w
-1,w,w+1},
b[l*5];F b