Skip to content

Instantly share code, notes, and snippets.

View sjain882's full-sized avatar

sjain sjain882

  • United Kingdom
View GitHub Profile
@brianhassel
brianhassel / PreventSleep.cs
Last active March 13, 2026 22:56
Prevent Computer Sleep in C#
internal static class NativeMethods {
public static void PreventSleep() {
SetThreadExecutionState(ExecutionState.EsContinuous | ExecutionState.EsSystemRequired);
}
public static void AllowSleep() {
SetThreadExecutionState(ExecutionState.EsContinuous);
}
@nuomi1
nuomi1 / PrintBootCampESDInfo.swift
Last active August 2, 2026 03:56
macOS and BootCamp Latest
#!/usr/bin/env swift
//
// PrintBootCampESDInfo.swift
//
// Created by nuomi1 on 8/5/18.
// Copyright © 2018年 nuomi1. All rights reserved.
//
import Foundation
using System;
using System.Runtime.InteropServices;
// ReSharper disable SuspiciousTypeConversion.Global
// ReSharper disable InconsistentNaming
namespace VideoPlayerController
{
/// <summary>
/// Controls audio using the Windows CoreAudio API
/// from: http://stackoverflow.com/questions/14306048/controling-volume-mixer
@HamzaAnis
HamzaAnis / GlobalMouseClick.cs
Created June 8, 2018 20:00
A hook for global mouse clicks on a screen.
namespace Demo_mousehook
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
MouseHook mh;
@Yousha
Yousha / .gitignore
Last active April 10, 2026 18:34
.gitignore for C/C++ developers.
##### Windows
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
@qoomon
qoomon / conventional-commits-cheatsheet.md
Last active August 2, 2026 08:14
Conventional Commits Cheatsheet
@C-Duv
C-Duv / steamdb-bookmarklet.js
Created June 10, 2019 17:22
Bookmarklet to open Steam Database (steamdb.info) page from Steam Store (store.steampowered.com) page
/**
How to use:
1/ Use the following line as the "URL" of a bookmark in your web browser.
2/ Place the bookmark in the bookmark bar for easy access.
3/ When on a steampowered.com page, click on the bookmark and the corresponding steamdb.info page will open.
*/
javascript:(function(){if (window.location.hostname == 'store.steampowered.com') {var pathMatch = window.location.pathname.match(/^\/(?<appType>(app|bundle|sub))\/(?<appId>\d+)\//);pathMatch && window.open('https://steamdb.info/' + pathMatch.groups.appType + '/' + pathMatch.groups.appId + '/?source=bookmarklet','_blank');}})();
@tcartwright
tcartwright / Start-ProcessEx.ps1
Last active July 19, 2025 19:22
POWERSHELL: Start Process, capturing output events
function Run-Process {
param(
[Parameter(Mandatory=$true)]
[string]$Exe,
[string]$ExeArgs,
[switch]$DoNotWriteLog,
[string]$LogFormat = "yyyy-MM-dd HH:mm:ss.ffff"
)
Write-Verbose "From powershell running: $exe $exeArgs"
@valinet
valinet / README.md
Last active June 10, 2026 22:53
Get dark command windows all the time in Windows

Case study: Get dark command windows all the time in Windows

TL;DR

  1. Make a copy conhost.exe from System32.
  2. Open it with a hex editor (I use HxD).
  3. In HxD, go to Search - Find - Hex-values.
  4. Search for 881d9e530a004885c07477ff15b32e08009084c0.
  5. In Windows 10 version 2004, replace ff15b32e0800 with 909090909090. If using Windows 10 version 20H2, replace ff15b32e08009084 with 9090909090909090.
  6. Save file and copy it back to System32 (take ownership of original conhost.exe in order to replace it).
  7. Profit!