Skip to content

Instantly share code, notes, and snippets.

View mcandre's full-sized avatar

Andrew mcandre

  • Milwaukee, WI
View GitHub Profile
@mcandre
mcandre / dprintf.c
Created January 10, 2019 02:23
crude dprintf() shim for Illumos and Haiku OS
int dprintf(int fd, const char *restrict format, ...) {
va_list ap;
FILE *f = fdopen(fd, "w");
if (!f) {
return -1;
}
va_start(ap, format);
int result = fprintf(f, format, ap);
@sleepdefic1t
sleepdefic1t / MACOS_CLANG_TIDY.md
Last active September 30, 2024 11:09
brew clang-tidy on macOS
brew install llvm
ln -s "/usr/local/opt/llvm/bin/clang-format" "/usr/local/bin/clang-format"
ln -s "/usr/local/opt/llvm/bin/clang-tidy" "/usr/local/bin/clang-tidy"

use cmake file

  find_program(CLANG_TIDY_BIN clang-tidy)
 find_program(RUN_CLANG_TIDY_BIN /usr/local/Cellar/llvm/10.0.0_3/share/clang/run-clang-tidy.py)
@mcandre
mcandre / patches.md
Last active November 26, 2019 02:57
patches, bb!
@mcandre
mcandre / postgresql-backup-and-restore.md
Last active October 6, 2022 22:24
PostgreSQL Backup and Restore

POSTGRESQL BACKUP AND RESTORE

$ pg_dumpall --clean -U <user> -f backup.sql
$ psql -U <user> -f backup.sql

Warnings

  • A PostgreSQL user with administrative privileges is required.
@mcandre
mcandre / microsoft-windows-persist-window-dimensions.md
Created April 15, 2020 13:59
Microsoft Windows Persist Window Dimensions

Microsoft Windows Persist Window Dimensions

  1. Hold Control while selecting the Close button.
  2. Relaunch the application.
@mcandre
mcandre / launch-valorant.md
Created June 16, 2020 16:45
Launch Valorant (from CLI, Steam, GOG, etc.)
"C:\Riot Games\Riot Client\RiotClientServices.exe" --launch-product=valorant --launch-patchline=live
@mcandre
mcandre / mac-enable-libfuzzer.md
Created March 19, 2021 18:17
macOS Enable libFuzzer
  1. Run brew install llvm --HEAD.
  2. Update certain shell variables:
# Prefer newer LLVM with fuzzing enabled
# shellcheck source=/dev/null
export CC='clang'
export CXX='clang++'
export LDFLAGS="-L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib"
PATH="$(brew --prefix)/opt/llvm/bin:$PATH"
@mcandre
mcandre / windows-install-msvc-and-clang.md
Last active May 1, 2021 02:22
Windows Install MSVC and clang

Windows Install MSVC and clang

  1. Install Chocolatey.
  2. Launch a PowerShell terminal in administrator mode.
  3. Install visualstudio2019community.
  4. Install the Visual Studio 2019 native C++ Desktop workload with the optional MSVC and clang components included:
PS C:\> choco install --force visualstudio2019-workload-nativedesktop --package-parameters "--includeOptional"
@mcandre
mcandre / show-binary-dependencies.md
Last active April 26, 2021 02:50
Show Dependencies

General UNIX/Linux

$ ldd <binary>

macOS

$ otool -L 
@Syncrossus
Syncrossus / python_monokaish.nanorc
Last active January 14, 2022 20:33
My attempt at making a Monokai python syntax coloring for nano based on scopatz/nanorc
## Python syntax highlighting rules for Nano
## The colors chosen here may seem strange.
## In my terminal, "yellow" = orange, "magenta" = purple, "brightyellow" = yellow, "cyan" = teal.
## Since there is no actual magenta, I used "brightred" which is the closest I could get.
## Since there is no grey, black is difficult to read in a terminal and setting the background to
## white is harsh on the eyes, I decided to use teal for comments.
syntax "python" "\.py$"
header "^#!.*/(env +)?python[-0-9._]*( |$)"
magic "Python script"