Skip to content

Instantly share code, notes, and snippets.

View richinseattle's full-sized avatar

richinseattle

View GitHub Profile
@richinseattle
richinseattle / weggli.bat
Created March 30, 2024 12:14
Run all raptor's weggli rules on current directory from cmd.exe
REM buffer overflows
REM call to unbounded copy functions (CWE-120, CWE-242, CWE-676)
weggli.exe -R "func=^gets$" "{$func();}" .
weggli.exe -R "func=st(r|p)(cpy|cat)$" "{$func();}" .
weggli.exe -R "func=wc(s|p)(cpy|cat)$" "{$func();}" .
weggli.exe -R "func=sprintf$" "{$func();}" .
weggli.exe -R "func=scanf$" "{$func();}" .
@richinseattle
richinseattle / static_scan.md
Last active November 30, 2023 23:04
Static analysis queries for semgrep, weggli, and others
@richinseattle
richinseattle / bashGPT.sh
Created November 10, 2023 00:17
bash OpenAI GPT client loop
#!/bin/bash
# bashGPT - [email protected]
[ "${OPENAI_API_KEY}" == "" ] && echo "Please set OPENAI_API_KEY env variable" && exit
[ "$(which jq)" == "" ] && echo "Please install the jq program" && exit
[ "$(which curl)" == "" ] && echo "Please install the curl program" && exit
PROMPT="$1"
while true
@richinseattle
richinseattle / memdjpeg.c
Created October 5, 2023 06:35 — forked from PhirePhly/memdjpeg.c
A bare-bones example of how to use jpeglib to decompress a jpg in memory.
// memdjpeg - A super simple example of how to decode a jpeg in memory
// Kenneth Finnegan, 2012
// blog.thelifeofkenneth.com
//
// After installing jpeglib, compile with:
// cc memdjpeg.c -ljpeg -o memdjpeg
//
// Run with:
// ./memdjpeg filename.jpg
//
@richinseattle
richinseattle / wsl2_network_fix.ps1
Created September 13, 2023 04:50
Fixes slow network i/o under WSL2. Run from host.
Disable-NetAdapterBinding -Name "vEthernet (WSL)" -ComponentID ms_tcpip6 -IncludeHidden
Disable-NetAdapterLso -Name "vEthernet (WSL)" -IncludeHidden
@richinseattle
richinseattle / cuda_11.3_installation_on_Ubuntu_20.04
Created April 13, 2023 03:48 — forked from Mahedi-61/cuda_11.8_installation_on_Ubuntu_22.04
Instructions for CUDA v11.3 and cuDNN 8.2 installation on Ubuntu 20.04 for PyTorch 1.11
#!/bin/bash
### steps ####
# verify the system has a cuda-capable gpu
# download and install the nvidia cuda toolkit and cudnn
# setup environmental variables
# verify the installation
###
### to verify your gpu is cuda enable check
@richinseattle
richinseattle / ubuntu20-hyperv-enhanced-session.md
Created January 31, 2023 07:45 — forked from milnak/ubuntu20-hyperv-enhanced-session.md
[Enabling enhanced session in Hyper-V for Ubuntu 20] This works for me, although it seems that Hyper-V quick create now supports enhanced session by default. #ubuntu #hyperv

Setup Hyper-V enhanced session for Ubuntu 20

I couldn't find instructions that were 100% complete, so I put this together.

These instructions worked fine for me. Follow each step carefully.

Download Ubuntu 20 desktop

DO NOT create the VM by choosing Quick Create in Hyper-V Manager. Follow these instructions exactly.

@richinseattle
richinseattle / fork.c
Created January 15, 2023 10:05 — forked from petrsmid/fork.c
fork() for Windows with fixed Console
/*
* fork.c
* Experimental fork() on Windows. Requires NT 6 subsystem or
* newer.
*
* Improved version with fixed Console
*
* Copyright (c) 2023 Petr Smid
* Copyright (c) 2012 William Pitcock <[email protected]>
*
SSRF Bypass List
Base-Url: 127.0.0.1
Client-IP: 127.0.0.1
Http-Url: 127.0.0.1
Proxy-Host: 127.0.0.1
Proxy-Url: 127.0.0.1
Real-Ip: 127.0.0.1
Redirect: 127.0.0.1
Referer: 127.0.0.1
@richinseattle
richinseattle / nginx.conf
Created November 14, 2022 04:23
Optimized nginx config from hestiacp github project
# Server globals
user admin;
worker_processes 1;
worker_rlimit_nofile 65535;
error_log /var/log/hestia/nginx-error.log;
pid /var/run/hestia-nginx.pid;
# Worker config
events {
worker_connections 128;