Skip to content

Instantly share code, notes, and snippets.

View 0017031's full-sized avatar
🎯
Focusing

fcccp 0017031

🎯
Focusing
View GitHub Profile
@0017031
0017031 / vs_cpp_winget.md
Created June 9, 2025 02:27 — forked from robotdad/vs_cpp_winget.md
Installing VS C++ workloads with winget

This is a short outline of how to install the C++ workload with Visual Studio or the build tools using winget.

To find VS releases with winget use search. winget search buildtools

The install command will install the VS installer with the core of the selected product installed. That isn't much. So if you use either of these commands to insll VS or the build tools you will need to launch the VS installer afterwards and select the relevant C++ workloads you need.

winget install Microsoft.VisualStudio.2022.BuildTools

winget install Microsoft.VisualStudio.2022.Community
@0017031
0017031 / Main.fsx
Created March 6, 2024 09:09 — forked from Midoliy/Main.fsx
代替データストリームのサンプル
#load "NativeMethod.fsx"
open System
open System.IO
open System.Text
open NativeMethod
let nullptr = IntPtr.Zero
let write (str:string) handle =
@0017031
0017031 / NativeMethods.fs
Created March 6, 2024 09:09 — forked from latkin/NativeMethods.fs
F# p/invoke example with structs
namespace Test
open System.Runtime.InteropServices
// F# implementation of http://pinvoke.net/default.aspx/mpr.WNetAddConnection2
module NativeMethods =
type ResourceScope =
| Connected = 0x1u
| GlobalNet = 0x2u
@0017031
0017031 / trampoline.fsx
Created February 27, 2024 08:04 — forked from gusty/trampoline.fsx
Trampolines in F#
let trampoline f c n =
let rec loop = function
| Choice1Of2 x -> x
| Choice2Of2 x -> loop (f x)
loop (Choice2Of2 (c,n))
// Test
let factorial n =
let rec factorialT (current, n) =
if n = bigint 0 then Choice1Of2 current
@0017031
0017031 / running.fs
Created February 27, 2024 07:57 — forked from thomasd16/running.fs
Full Trampoline monad
//This just weves the prepareStackFree function in through the running function
//what we end up with is what looks like a nested monad
type 't Running =
|Result of 't
|Step of (unit->'t Running)
type 't RunningBuilder = RunningBuilder of ((('t->'t RunningBuilder) list)->'t Running)
type RunningMonad() =
member this.Bind(RunningBuilder expr,fn) =
RunningBuilder(fun stack-> Step(fun()->expr(fn::stack)))
member this.Delay(fn) =
open System
open System.Diagnostics
type InteractionF<'f> =
| Get of (string -> 'f)
| Put of string * 'f
with
static member map f = function
| Get g -> Get (f << g)
| Put (s, g) -> Put (s, f g)
@0017031
0017031 / !portable-msvc.md
Last active June 25, 2025 06:15 — forked from mmozeiko/!README.md
Download MSVC compiler/linker & Windows SDK without installing full Visual Studio

Forked from: https://gist.github.com/mmozeiko/7f3162ec2988e81e56d5c4e22cde9977

This downloads standalone 64-bit MSVC compiler, linker & other tools, also headers/libraries from Windows SDK into portable folder, without installing Visual Studio. Has bare minimum components - no UWP/Store/WindowsRT stuff, just files & tools for 64-bit native desktop app development.

Run python.exe portable-msvc.py and it will download output into msvc folder. By default it will download latest available MSVC & Windows SDK
(MANIFEST_URL = "https://aka.ms/vs/17/release/channel")
(https://learn.microsoft.com/en-us/visualstudio/releases/2022/release-history)

You can list available versions with python.exe portable-msvc.py --show-versions and then pass versions you want with --msvc-version and --sdk-version arguments.

@0017031
0017031 / JetbrainsEvaluationReset_2020.py
Created December 8, 2022 08:06 — forked from mreyesv/JetbrainsEvaluationReset_2020.py
[Activate] A Python Script To Reset The Evaluation License Of These Jetbrains Products Released In 2020 Or Later (IntelliJIdea, CLion, Rider, PyCharm, RubyMine, GoLand )
# Reset Jetbrains 2020 Products
import glob
import os
import winreg
from os import path
from os.path import expanduser
home = expanduser("~")
newJetbrainsHome = path.join(home, "AppData\Roaming\JetBrains")
@0017031
0017031 / endianness.h
Created October 16, 2020 03:39 — forked from jtbr/endianness.h
cross-platform / cross-compiler standalone endianness conversion
/**
* @file endianness.h
* @brief Convert Endianness of shorts, longs, long longs, regardless of architecture/OS
*
* Defines (without pulling in platform-specific network include headers):
* bswap16, bswap32, bswap64, ntoh16, hton16, ntoh32 hton32, ntoh64, hton64
*
* Should support linux / macos / solaris / windows.
* Supports GCC (on any platform, including embedded), MSVC2015, and clang,
* and should support intel, solaris, and ibm compilers as well.
@0017031
0017031 / PurgeStandbyList.cpp
Created August 26, 2020 04:04 — forked from bitshifter/PurgeStandbyList.cpp
Command line utility for purging Window's standby list. Requires /MANIFESTUAC:"level='highestAvailable'.
#include <windows.h>
#include <stdio.h>
#include <tchar.h>
#define NT_SUCCESS(Status) (((NTSTATUS)(Status)) >= 0)
#define STATUS_PRIVILEGE_NOT_HELD ((NTSTATUS)0xC0000061L)
typedef enum _SYSTEM_INFORMATION_CLASS {
SystemMemoryListInformation = 80, // 80, q: SYSTEM_MEMORY_LIST_INFORMATION; s: SYSTEM_MEMORY_LIST_COMMAND (requires SeProfileSingleProcessPrivilege)
} SYSTEM_INFORMATION_CLASS;