Skip to content

Instantly share code, notes, and snippets.

View mrjohannchang's full-sized avatar

Johann Chang mrjohannchang

View GitHub Profile
@jborean93
jborean93 / ServiceRecovery.ps1
Last active July 21, 2025 21:01
Get and Set the Windows service recovery options
# Copyright: (c) 2018, Jordan Borean (@jborean93) <[email protected]>
# MIT License (see LICENSE or https://opensource.org/licenses/MIT)
Add-Type -TypeDefinition @'
using Microsoft.Win32.SafeHandles;
using System;
using System.Collections.Generic;
using System.Runtime.ConstrainedExecution;
using System.Runtime.InteropServices;
@rgl
rgl / python-embedded.md
Last active March 18, 2024 15:33
notes about python embedded in windows

The gist is:

  1. install the normal python from python.org
  2. install everything into a venv
  3. copy the venv into python embed.

A raw example

unzip python-3.8.0-embed-amd64.zip
@papachristoumarios
papachristoumarios / git-lfs-sync.sh
Created October 7, 2019 15:07
Git LFS Sync between remotes
#!/bin/bash
# Sync two git LFS remotes. This is very useful when you
# have two remotes (e.g. upstream and fork) and they have
# different files on the LFS storage. Trying git lfs fetch --all
# yields an error for missing objects if the two repos are not
# synced. The purpose of this script is to overcome this issue
# with Git LFS
#
# Usage: git-lfs-sync.sh source destination branch
#
/// Make CPUs usage as a sin wave
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <unistd.h>
const float PI = 3.1415926;
const int TIME_SLICE = 40000; // 40 ms
@dantmnf
dantmnf / winocr.py
Last active May 30, 2025 23:57
WinRT OcrEngine from Python
import sys
import asyncio
import base64
import copy
import pprint
# pip3 install winrt
from winrt.windows.media.ocr import OcrEngine
from winrt.windows.globalization import Language
from winrt.windows.graphics.imaging import *
from winrt.windows.security.cryptography import CryptographicBuffer
@scmx
scmx / git-commit-title-first-word.md
Last active October 12, 2025 17:25
Example list of verbs / first word to use in git commit title #git #commit #title

Example list of first words to use in a git commit title

I like writing well-formed git commits that explain the intention behind why a code change was made.

Check out Chris Beams excellent How to Write a Git Commit Message if you haven't read it.

Anyway, for a project I've been working on I've gathered up 900+ commits that hold up a pretty high quality (except for one 😁). Let's look at some trends about these commits!

Most common first words in commit titles of a project

@effigies
effigies / python_packaging_2019.md
Last active October 12, 2020 19:10
Contemporary Python Packaging - August 2019

Contemporary Python Packaging

This document lays out a set of Python packaging practices. I don't claim they are best practices, but they fit my needs, and might fit yours.

Validity

This document has been superseded as of July 2020.

This was written in July 2019. As of this writing Python 2.7 and Python 3.5 still have not

@jsmcnair
jsmcnair / Get-CinebenchScore.ps1
Last active June 13, 2021 02:25
PowerShell Cinebench score generator
function Get-CinebenchScore {
$source = "http://http.maxon.net/pub/cinebench/CinebenchR20.zip"
$out = "C:\CinebenchR20.zip"
$cbfolder = "C:\cinebench\"
$cbpath = Join-Path $cbfolder "cinebench.exe"
$log = Join-Path $cbfolder "log.txt"
if(-not (Test-Path $cbpath)) {
# Download
Invoke-WebRequest -Uri $source -OutFile $out
@fcharlie
fcharlie / profile.json
Last active July 22, 2024 08:08
My Windows Terminal profile.json
// This file was initially generated by Windows Terminal 0.11.1333.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
// You can add more global application settings here.
@dteoh
dteoh / .gitconfig
Created March 17, 2019 23:40
Use Neovim as git mergetool
[merge]
tool = vimdiff
[mergetool]
keepBackup = false
[mergetool "vimdiff"]
cmd = nvim -d $LOCAL $REMOTE $MERGED -c '$wincmd w' -c 'wincmd J'