Skip to content

Instantly share code, notes, and snippets.

@echo off
diskpart /s make-partitions.txt
dism /Apply-Image /ImageFile:E:\sources\install.wim /Index:1 /ApplyDir:W:\
bcdboot W:\Windows /s S: /f UEFI
@Tatsh
Tatsh / pf-faq46.txt
Created September 24, 2020 01:00
This is the closest-matching documentation for macOS' version of PF.
==============================================================================
Language: en [teams]
de fr it nl pl pt ru
PF: The OpenBSD Packet Filter
------------------------------------------------------------------------------
Table of Contents
From 9ed72ef140d40bc1ccea5911b38fa78e7faea160 Mon Sep 17 00:00:00 2001
From: Dan Aloni <dan@kernelim.com>
Date: Wed, 1 Apr 2020 12:28:15 +0300
Subject: [PATCH 1/2] Support a script to be executed when the device goes up
This adds the `ifup_script` config option. The script receives the
following environment variables as input:
- NET_DEVICE: The name of the network device of the VPN.
- DNS_SUFFIX: DNS domain search prefix, if provided by the VPN server.
@Tatsh
Tatsh / screenshot-win32.c
Created May 10, 2012 03:52
Make a screen shot (Win32)
#include <windows.h>
#include <stdio.h>
void errhandler(char *msg) {
printf("%s\n", msg);
}
PBITMAPINFO CreateBitmapInfoStruct(HWND hwnd, HBITMAP hBmp)
{
BITMAP bmp;
@Tatsh
Tatsh / gist:89c700d8d3ab33293a04c0f059f70aa2
Last active March 6, 2021 22:13
HPLIP: Skip installation of plug-in

The HPLIP UI is sometimes very buggy when it comes a) detecting plug-ins are already installed, and b) downloading the ones from HP's site. This has been my experience.

This page shows the list of supported devices and whether they need a plugin and for what reason. If you only want to use printing functionality of your device and your print functionality does not require a plugin, you can skip plugin installation with the steps below.

  1. Install HPLIP the normal way on your distro.
  2. As root, edit /usr/share/hplip/data/models/models.dat (or equivalent path).
  3. Find your device model in the file. It will be in underscore_style and may not be exactly what is written on your box or device. I have the Color LaserJet MFP M277dw, so I search for m277dw.
  4. Find the line in this section that says plugin=1. Change this to plugin=0.
  5. Restart hp-setup.
@Tatsh
Tatsh / pushd.py
Created October 24, 2013 05:26
pushd for Python
from os import chdir, getcwd
from os.path import realpath
class PushdContext:
cwd = None
original_dir = None
def __init__(self, dirname):
self.cwd = realpath(dirname)
@Tatsh
Tatsh / missing.md
Last active January 16, 2021 11:26
Big Sur MacPorts migration notes

Fixed

  • git-lfs
  • binary only: shellcheck Trac PR
  • binary only: pandoc Trac
  • duti PR
  • pinentry-mac (to install gnupg2) PR
  • EnvPane - added missing dependency discount
@Tatsh
Tatsh / chrome-clear-host-cache.js
Last active December 6, 2020 04:47
JXA script to clear Chrome's DNS cache. May not be totally reliable. Only for demonstration of how to run JS in Chrome from JXA.
#!/usr/bin/osascript -l JavaScript
ObjC.import('stdlib')
const t = Application('Google Chrome')
.windows[0]
.activeTab()
t.url = 'chrome://net-internals/#dns'
delay(0.5)
t.execute({
javascript: 'document.querySelector("#dns-view-clear-cache").click()'
})
@Tatsh
Tatsh / build-retroarch-ios.sh
Created November 3, 2020 03:39
Build RetroArch scripts
#!/usr/bin/env bash
set -e
SIGNING_IDENTITY=-
mkdir -p ~/dev/retroarch
cd ~/dev/retroarch
if ! [ -d retroarch ]; then
git clone https://github.com/libretro/RetroArch.git retroarch
fi