Skip to content

Instantly share code, notes, and snippets.

View juntalis's full-sized avatar

Charles Grunwald juntalis

View GitHub Profile
/*
* fork.c
* Experimental fork() on Windows. Requires NT 6 subsystem or
* newer.
*
* Copyright (c) 2012 William Pitcock <nenolod@dereferenced.org>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
@juntalis
juntalis / find-msvc.cmd
Last active December 27, 2023 12:33
Utility batch script to locate Visual Studio installation
@echo off
rem Usage: find-msvc.cmd MinimumVersion MaximumVersion
rem
rem Given a range of versions to search for, this script attempts to locate a
rem valid Visual Studio installation based upon the current set of environment
rem variables. If a valid installation is found, this script sets the
rem environment variable "VCROOT" to Drive:\Path\To\VS\VC. On success, we
rem should be able to call %VCROOT%\vcvarsall.bat.
rem
rem Versions use the VSXX0COMNTOOLS environment variable:
@juntalis
juntalis / findlinks.c
Last active April 16, 2023 04:07
Find hard links for a given filepath
@juntalis
juntalis / msys-env.cmd
Created October 17, 2011 00:07
A (Windows) batch script to open the MSYS shell in the user's current window (cmd.exe or whatever wrapper you're using) at the user's current folder. It requires getcp.exe be in your msys bin folder. (getcp.exe is included with msysgit) It also generates
@rem Do not use "echo off" to not affect any child calls.
@SETLOCAL
@SETLOCAL ENABLEEXTENSIONS
:: Figure out where msys's root folder. If you want, you could just add the folder in the line
:: below.
@set MSYSROOT=
@if "x%MSYSROOT%"=="x" @if exist "%~dp0msys.bat" @set MSYSROOT=%~dp0
@if "x%MSYSROOT%"=="x" @if exist "%~dp0.msys-root" @set /P MSYSROOT=<%~dp0.msys-root
@if "x%MSYSROOT%"=="x" (
@juntalis
juntalis / findlinks.c
Created December 13, 2020 00:11
Win32 hard link enumeration that should be compatible back to Windows XP.
@juntalis
juntalis / pytab.py
Created October 25, 2012 19:06
Declarations
# c_void_p PyMem_Malloc(c_size_t)
PyMem_Malloc = _dll.PyMem_Malloc
PyMem_Malloc.restype = c_void_p
PyMem_Malloc.argtypes = [ c_size_t ]
# c_void_p PyMem_Realloc(c_void_p, c_size_t)
PyMem_Realloc = _dll.PyMem_Realloc
# encoding: utf-8
"""
monkeypatch
TODO: Description
This program is free software. It comes without any warranty, to
the extent permitted by applicable law. You can redistribute it
and/or modify it under the terms of the Do What The Fuck You Want
To Public License, Version 2, as published by Sam Hocevar. See
http://sam.zoy.org/wtfpl/COPYING for more details.
# encoding: utf-8
"""
monkeypatch
TODO: Description
This program is free software. It comes without any warranty, to
the extent permitted by applicable law. You can redistribute it
and/or modify it under the terms of the Do What The Fuck You Want
To Public License, Version 2, as published by Sam Hocevar. See
http://sam.zoy.org/wtfpl/COPYING for more details.
@echo off
goto Main
:GetVirtualEnvName
rem If the foldername of the virtual env contains a dot, (ex: .vip)
rem part of the foldername will end up in the extension part of the path.
rem Because of that, we'll combine the extension and name parts of the
rem path.
set PROMPT=(%~n1%~x1) %PROMPT%
goto :EOF
#pragma comment(lib, "advapi32.lib")
#include <windows.h>
#include <winnt.h>
#include <tlhelp32.h>
#include <tchar.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>