Skip to content

Instantly share code, notes, and snippets.

@jeremyd2019
jeremyd2019 / testfork.c
Last active May 21, 2024 00:27
reproducer for cygwin hangs under emulation on arm64
#include <stdio.h>
#include <sys/wait.h>
#include <unistd.h>
#ifndef BINARY
#define BINARY "/bin/true"
#endif
#ifndef ARG
#define ARG "0.1"
@jeremyd2019
jeremyd2019 / rust_beta.py
Created April 22, 2024 19:45
Script to convert msys2's mingw-w64-rust PKGBUILD to build latest beta
#!/usr/bin/env python
import fileinput
import pprint
import re
import tomli
from urllib.request import urlopen
with urlopen("https://static.rust-lang.org/dist/channel-rust-beta.toml") as f:
x = tomli.load(f)
#include <stdio.h>
#include <gmp.h>
/* due to https://github.com/msys2/MINGW-packages/issues/15715
* variables/constants are lacking dllimport annotations. But clang/lld are
* doing some magic with refptrs that results in a simple access of gmp_version
* *not* requiring a pseudo-relocation. This more contrived example results in
* a pseudo-relocation on i386, x86_64, and aarch64, with gcc/bfd and clang/lld
* (as applicable) */
@jeremyd2019
jeremyd2019 / update-llvm.sh
Last active June 8, 2023 23:34
scripts to update packages
#!/bin/bash -e
set -o pipefail
newversion="$1"
newrc=""
if [[ $newversion == *-rc* ]]; then
newrc="-${newversion#*-}"
newversion="${newversion%%-*}"
@jeremyd2019
jeremyd2019 / createbase.cmd
Created March 30, 2022 20:41
CMD scripts for creating/mounting/umounting VHDX base and differential disk images
@ECHO OFF
SETLOCAL
IF "%~f1" == "" GOTO :usage
IF NOT EXIST "%~f2" GOTO :usage
if "%~3" == "" GOTO :usage
REM just to be sure...
CALL "%~dp0\vhdumount.cmd" "%~1"
DEL /F /Q "%~f1"
(
@jeremyd2019
jeremyd2019 / runner-reg.py
Created November 20, 2021 00:39
pygithub self-hosted runner tokens
#!/usr/bin/env python
from github import Github, GithubIntegration, Consts, Installation, GithubObject
import github.Organization
import re
import requests
my_appid = 123
my_keyfile = "private-key.pem"
my_org = 'myorg'
@jeremyd2019
jeremyd2019 / README.md
Last active October 22, 2021 02:07
script to extract guids from a .lib

Example:

user@host CLANG32 ~/guidgrabber
$ ./guidgrabber.sh /d/Program\ Files/Windows\ Kits/10/Lib/10.0.22000.0/um/x86/Bits.Lib
...
DEFINE_GUID(CLSID_BackgroundCopyQMgr, 0x69AD4AEE, 0x51BE, 0x439B, 0xA9, 0x2C, 0x86, 0xAE, 0x49, 0x0E, 0x8B, 0x30);
DEFINE_GUID(IID_IBackgroundCopyCallback1, 0x084F6593, 0x3800, 0x4E08, 0x9B, 0x59, 0x99, 0xFA, 0x59, 0xAD, 0xDF, 0x82);
DEFINE_GUID(IID_IBackgroundCopyGroup, 0x1DED80A7, 0x53EA, 0x424F, 0x8A, 0x04, 0x17, 0xFE, 0xA9, 0xAD, 0xC4, 0xF5);
DEFINE_GUID(IID_IBackgroundCopyJob1, 0x59F5553C, 0x2031, 0x4629, 0xBB, 0x18, 0x26, 0x45, 0xA6, 0x97, 0x09, 0x47);
DEFINE_GUID(IID_IBackgroundCopyQMgr, 0x16F41C69, 0x09F5, 0x41D2, 0x8C, 0xD8, 0x3C, 0x08, 0xC4, 0x7B, 0xC8, 0xA8);
@jeremyd2019
jeremyd2019 / README.txt
Last active March 24, 2022 18:23
blocked dep tree for clang32
├── mingw-w64-clang-i686-rust
│ ├── mingw-w64-clang-i686-lsd
│ ├── mingw-w64-clang-i686-starship
│ ├── mingw-w64-clang-i686-cargo-c
│ │ ├── mingw-w64-clang-i686-rav1e
│ │ │ ├── mingw-w64-clang-i686-libheif
│ │ │ ├── mingw-w64-clang-i686-ffmpeg
│ │ │ ├── mingw-w64-clang-i686-libavif
│ ├── mingw-w64-clang-i686-python-setuptools-rust
│ ├── mingw-w64-clang-i686-python-maturin
@jeremyd2019
jeremyd2019 / ucrt-bad-import.c
Last active August 15, 2021 05:48
tool to determine if an image imports malloc from math dll
#include <stdio.h>
#include <strings.h>
#include "img.h"
#define GET_UINT(PEIMG, POS) fimg_get_uint_at((PEIMG)->pimg, (POS), (PEIMG)->is_bigendian)
#define GET_UQUAD(PEIMG, POS) fimg_get_uquad_at((PEIMG)->pimg, (POS), (PEIMG)->is_bigendian)
int main(int argc, char **argv)
{
pe_image *pe;
@jeremyd2019
jeremyd2019 / pesubsys.c
Last active March 27, 2024 19:48
program to get and set subsystem in PE headers
#include <windows.h>
#include <stddef.h>
#include <stdio.h>
int main(int argc, char ** argv)
{
FILE * fh;
IMAGE_DOS_HEADER idh = {0};
DWORD signature = 0;
long subsys_offset = 0;