This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// gcc -fPIC -shared hello_so.c -o libhello.so | |
// gcc hello_dl.c -o hello | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <dlfcn.h> | |
const char *LIB_SO = "./libhello.so"; | |
int main(void) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
/* | |
* https://gcc.gnu.org/onlinedocs/cpp/Stringizing.html | |
* https://hmijailblog.blogspot.com/2016/03/an-isdefined-c-macro-to-check-whether.html | |
*/ | |
#define str(s) #s | |
#define xstr(s) str(s) | |
#define quote(s) str(#s) | |
#define isdefined(s) (__builtin_strcmp("" #s, str(s)) != 0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Hacky little Python script to get Windows Version directly | |
out of running process memory. | |
This is a toy. Not sure why you would really want to do this. | |
Windows undocumented API: https://stackoverflow.com/a/79014708/8524178 | |
Requires the unsafe.py file from https://github.com/DavidBuchanan314/unsafe-python/blob/main/unsafe.py | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import os | |
import csv | |
import sys | |
import textwrap | |
import subprocess | |
from io import StringIO | |
from colorama.ansitowin32 import AnsiToWin32 as AnsiToText | |
class AnsiToText: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import os | |
import csv | |
import sys | |
import textwrap | |
import platform | |
import subprocess | |
from io import StringIO | |
from colorama.ansitowin32 import AnsiToWin32 as AnsiToText |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Toml Everywhere | |
A wrapper that allows any command line program to have a `--config` flag. | |
No explicit support required! | |
Call as: | |
$ toml_everywhere.py program [argument ...] --config config.cfg |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Simplified PathType | |
- Simplify for common case | |
- Only one type, no more (never used really) | |
- No dash support, just simplier | |
- No symilnk (never used) | |
A helper type for input validation in argparse for paths. | |
This provides a convienent way to check the path type and existance. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
PathType | |
A helper type for input validation in argparse for paths. | |
This provides a convienent way to check the paths type, existance, and | |
potentially use "-" to reference stdin or stdout. | |
This class is provided as an alternative to argparse.FileType(), which | |
does not open the path, only validates it and supports directories. |
NewerOlder