Skip to content

Instantly share code, notes, and snippets.

View kourbou's full-sized avatar

Kouroche Bouchiat kourbou

View GitHub Profile
@kourbou
kourbou / exec.rs
Created April 29, 2024 13:11
Quick'n'dirty executable wrapper in Rust.
use std::env;
use std::io::Result;
use std::process::{Command, ExitCode, Stdio};
fn main() -> Result<ExitCode> {
let status = Command::new(r"C:\Program Files\Git\usr\bin\vim.exe")
.args(env::args().skip(1))
.stdin(Stdio::inherit())
.stdout(Stdio::inherit())
.stderr(Stdio::inherit())
@kourbou
kourbou / capslock-as-ctrl.ps1
Created March 4, 2024 10:46
Using Caps Lock as Ctrl on Windows 11
New-ItemProperty `
-Path 'HKLM:\System\CurrentControlSet\Control\Keyboard Layout' -Name 'Scancode Map' -PropertyType Binary `
-Value 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00
Restart-Computer
@kourbou
kourbou / xterm-256-colors.py
Last active September 27, 2023 15:55
Generate a macOS color palette (.clr) for the Xterm 256 colors.
import Cocoa
XTERM_256_COLORS: list[str] = [
"000000",
"800000",
"008000",
"808000",
"000080",
"800080",
"008080",
@kourbou
kourbou / parquetinfo.py
Created April 4, 2023 14:57
Small utility to display the contents of a `.parquet` file in `notepad.exe`
import ctypes
import os
import subprocess
import sys
import tempfile
import traceback
import pandas as pd
MessageBoxW = ctypes.windll.User32.MessageBoxW
from serial import Serial
class ExpoVoltageController:
vid: int = 0x2341
pid: int = 0x0058
sid: str = "8E4E27AB515146544E4B2020FF090D2F"
def __init__(self, port: str, verbose: bool = False) -> None:
self.serial = Serial(port, baudrate=115200, timeout=10)
@kourbou
kourbou / StartVM.ps1
Last active March 24, 2021 13:30
Launch & shut-down scripts for Hyper-V
$VMName = 'MyVirtualMachine'
$IPAddress = '172.16.0.0'
Start-VM -Name $VMName
If (-Not $?) { Pause ; Exit }
Write-Host "Waiting for VM to reply to ping request. This window will close when VM is up."
Do { $Ping = Test-Connection $IPAddress -Count 1 -Quiet } Until ( $Ping )
@kourbou
kourbou / fetch_poppler.py
Created December 15, 2020 20:47
`poppler-utils` on 64-bit Windows
import shutil
from pathlib import Path
from conda.cli.python_api import Commands, run_command
PACKAGE_NAME = 'poppler'
PACKAGE_VERSION = '20.12.1'
PACKAGE_ENV_DIR = './poppler-env/'
@ECHO OFF
start /B "Xming" "C:\Program Files (x86)\Xming\Xming.exe" :0 -multiwindow -clipboard -dpi 108
set DISPLAY=127.0.0.1:0
echo Started X server (Xming).
ssh my-host
if errorlevel 1 pause
@kourbou
kourbou / UpdateNinja.ps1
Last active April 28, 2021 12:30
Install (or Update) Ninja Build on Windows (run in admin Powershell)
$repo = "ninja-build/ninja"
$file = "ninja-win.zip"
$dest = "C:\Program Files\Ninja"
$releases = "https://api.github.com/repos/$repo/releases/latest"
$asset = Invoke-RestMethod -Uri $releases |
Select-Object -ExpandProperty assets |
Where-Object {$_.name -eq $file}
$tmp = New-TemporaryFile | Rename-Item -NewName { $_ -replace 'tmp$', 'zip' } -PassThru
@kourbou
kourbou / cppreference.js
Created April 18, 2020 07:39
A user-script for better cppreference.com (Windows/Chrome/ViomentMonkey)
// ==UserScript==
// @name Use Consolas font - cppreference.com
// @match https://*.cppreference.com/*
// @grant GM_addStyle
// @run-at document-start
// ==/UserScript==
GM_addStyle ( `
body {
zoom: 110%;