Skip to content

Instantly share code, notes, and snippets.

View rofl0r's full-sized avatar

rofl0r

View GitHub Profile
@rofl0r
rofl0r / gist:1073739
Created July 9, 2011 16:53 — forked from angavrilov/gist:926972
mmap injection on linux (emulation of VirtualAllocEx)
/* Support for executing system calls in the context of the game process. */
static const int injection_size = 4;
static const char nop_code_bytes[injection_size] = {
/* This is the byte pattern used to pad function
addresses to multiples of 16 bytes. It consists
of RET and a sequence of NOPs. The NOPs are not
supposed to be used, so they can be overwritten. */
0xC3, 0x90, 0x90, 0x90
@rofl0r
rofl0r / init.c
Created August 6, 2013 21:15
minimal init daemon by rich felker, author of musl libc
#define _XOPEN_SOURCE 700
#include <signal.h>
#include <unistd.h>
int main()
{
sigset_t set;
int status;
if (getpid() != 1) return 1;
@rofl0r
rofl0r / android_file_urls.txt
Created February 1, 2021 01:59
filenames of all files on google android dl server
prefix with https://dl.google.com/android/repository/
from https://mirrors.cloud.tencent.com/AndroidSDK/ (might disappear)
Index of /AndroidSDK/
../
extras/ 10-May-2016 22:13 -
glass/ 10-Apr-2020 23:54 -
sys-img/ 27-Jul-2017 18:38 -
03e20ef07acac3ecac0790dfa946abd98e31bf7e.platfo..> 07-May-2020 00:02 9315273
@rofl0r
rofl0r / git-from-tarballs.sh
Created December 21, 2024 22:51
create git repo from a set of release tarballs
#!/bin/sh
test -z "$2" && {
echo "$0 DIR FILELIST.TXT"
echo "create a git repository in DIR from tarballs listed in FILELIST"
echo "you can create the FILELIST with ls -1 *.tar* and then edit it"
echo "so the order is correct."
echo
echo "this script abuses the fact that the combination of git rm and"
echo "git add successfully detects renamed files, so the process is"
echo "a lot simpler than it would otherwise be."
@rofl0r
rofl0r / github_2fa_oathtool.md
Created October 11, 2023 21:54
Using Github 2FA with oathtool

I've been forced by github to enable 2FA with the following banner:

GitHub users are now required to enable two-factor authentication as an additional security measure. Your activity on GitHub includes you in this requirement. You will need to enable two-factor authentication on your account before October 12, 2023, or be restricted from account actions.

Fortunately, i managed to make the switch using the FLOSS oathtool, a non-bloated CLI program written in C.

Once you click the "Enable 2FA" button, github presents you a barcode and a link to uncover the embedded "setup key". All you really need is the setup key, which as it turns out is Base32-encoded. The next step is to enter a 6-digit code supplied by the TOTP app. Here it is extremely important that your system clock is correct, best to sync with NTP directly before use.

@rofl0r
rofl0r / mode2.c
Created October 31, 2024 04:23
convert mode 2 cdrom image files (iso) to mode 1 format
#include <stdio.h>
#include <string.h>
/* small program to convert mode 2 form 1 (XA) cdrom iso files, as produced
by some windows software - maybe nero - to regular mode 1 iso file format.
because for some reason, linux can only mount mode 1 iso files.
the format encountered is basically a raw dump of the disc, including
checksum bytes, sync markers and header.
the means that the \1CD001 header starts at offset 0x9318 instead of 0x8000.
urban witch story walkthrough
.. because i imagine not everyone wants to download a 4 hrs youtube video for a single hint ...
leroy's house
talk with leroy (door)
talk with guy to learn he deals drugs and angela is a whore.
go to left (exit)
basketball court
working download location of html help workshop 1.3
http://web.archive.org/web/20160301111642/https://download.microsoft.com/download/0/A/9/0A939EF6-E31C-430F-A3DF-DFAE7960D564/htmlhelp.exe
$ sha256sum htmlhelp.exe
b2b3140d42a818870c1ab13c1c7b8d4536f22bd994fa90aade89729a6009a3ae htmlhelp.exe
m$ seems to be in the business of removing downloads not targeting their latest operating systems...
@rofl0r
rofl0r / sleep.c
Created March 13, 2012 03:04
gnu compatible sleep tool.
#define _POSIX_C_SOURCE 200809L
#include <sys/time.h>
#include <time.h>
#include <stdlib.h>
int main(int argc, char** argv) {
int i;
char* end;
int times;
for(i = 1; i < argc; i++) {