Skip to content

Instantly share code, notes, and snippets.

View MrDwarf7's full-sized avatar
🏠
Working from home

Blake B. MrDwarf7

🏠
Working from home
  • CyberVoid
View GitHub Profile
@jacob-acusensus
jacob-acusensus / TestFunction.cpp
Last active September 10, 2025 00:14
Acusensus Graduate Application Question
std::string TestFunction()
{
std::string result;
char c1 = 'a' + 125 % 50 - 1;
char c2 = 'a' + 0b0101 - 1; // 0b == binary literal
char c3 = 't' - 1;
result.push_back(c1);
result.push_back(c2);
result.push_back(c3);
result.insert(0, 1, toupper(c2));
@Csqhi515
Csqhi515 / CompactWSL.bat
Created October 18, 2024 17:35
Script to help compact WSL and vhdx.
@echo off
net session >nul 2>&1
if %errorlevel% neq 0 (
echo Requesting administrative privileges...
powershell -Command "Start-Process '%~f0' -Verb RunAs"
exit /b
)
wsl sudo fstrim --all; echo "Exit status: $?";
@AntonC9018
AntonC9018 / .wezterm.lua
Last active September 1, 2024 14:54
Wezterm config
local wezterm = require 'wezterm'
local act = wezterm.action
local config = wezterm.config_builder()
config.use_dead_keys = false
-- https://github.com/wez/wezterm/discussions/5102
config.enable_kitty_keyboard = true
config.allow_win32_input_mode = false
@denji
denji / 01-nvidia.conf
Last active October 13, 2025 05:01
/etc/modprobe.d/nvidia.conf
# /etc/modprobe.d/nvidia.conf
# NVIDIA Linux modprobe.d Configuration
#
# Memory and Performance Enhancements:
#
# - NVreg_UsePageAttributeTable=1 (Default: 0)
# Activates the Page Attribute Table (PAT) for improved memory management.
# PAT creates a partition table at a fixed register-mapped address, potentially enhancing CPU performance.
#
@pablomdo
pablomdo / Dockerfile
Created April 7, 2023 19:58
Docker Squid proxy server example
# Use the official Ubuntu 20.04 image as the base
FROM ubuntu:20.04
# Set environment variables to avoid interactive installation
ENV DEBIAN_FRONTEND=noninteractive
# Update package list and install Squid
RUN apt-get update && \
apt-get install -y squid
@david-a-perez
david-a-perez / fastest_day6_part2.rs
Last active October 17, 2025 06:38
Advent of Code 2023 Day 6 Optimizations
// time: [1.8843 µs 1.8897 µs 1.8955 µs]
pub fn original(input: &[u8]) -> Option<usize> {
let mut idx = 0;
'outer: while idx + 13 < input.len() {
let mut state = 0;
for (next_idx, byte) in input[idx..idx + 14].iter().enumerate().rev() {
let bit_idx = byte % 32;
if state & (1 << bit_idx) != 0 {
idx += next_idx + 1;
continue 'outer;
@marvinlehmann
marvinlehmann / powershell-wol.md
Created October 26, 2022 14:58
How to enable Wake-On-Lan on Windows 10 using PowerShell

Settings for Wake-On-Lan

0. Enabling it in BIOS/UEFI

1. Disabling fast startup and/or hibernation

Turning off fast startup:

New-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Power" -Name HiberbootEnabled -PropertyType DWord -Value 0 -Force

Disabling hibernation, which disables fast startup too (?): POWERCFG /HIBERNATE OFF

@mmozeiko
mmozeiko / !README.md
Last active October 24, 2025 21:04
Download MSVC compiler/linker & Windows SDK without installing full Visual Studio

This downloads standalone 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 native desktop app development.

Run py.exe portable-msvc.py and it will download output into msvc folder. By default it will download latest available MSVC & Windows SDK - currently v14.40.33807 and v10.0.26100.0.

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

To use cl.exe/link.exe first run setup_TARGET.bat - after that PATH/INCLUDE/LIB env variables will be updated to use all the tools as usual. You can also use clang-cl.exe with these includes & libraries.

To use clang-cl.exe without running setup.bat, pass extra /winsysroot msvc argument (msvc is folder name where output is stored).

@bubba-h57
bubba-h57 / instructions.md
Last active April 20, 2025 21:08
Configuring Jetbrains Gateway and WSL

Step 1: SSH Daemon

In your WSL instance, re-install OpenSSH server as follows.

sudo apt remove --purge openssh-server
sudo apt install openssh-server

Edit /etc/ssh/sshd_config (e.g. sudo vi /etc/ssh/sshd_config) and add the following lines to the bottom of the file. Ensure you replace WSL_ACCOUNT_NAME with your WSL2 account name.

@SynCap
SynCap / Rename-GitBranch.psm1
Last active September 27, 2023 11:53
Rename Git branch locally and remote with PowerShell
# Raname current branch Locally and Remote
function Rename-GitBranch {
[CmdletBinding()]
param(
[Parameter(mandatory=$true)][String] $OldName,
[Parameter(mandatory=$true)][String] $NewName,
[String] $UpstreamName = 'origin'
)
# Rename the local branch to the new name