Skip to content

Instantly share code, notes, and snippets.

View mislav's full-sized avatar

Mislav Marohnić mislav

View GitHub Profile
@mislav
mislav / bookmarklet.md
Last active February 13, 2024 16:18
cooked.wiki bookmarklet
View bookmarklet.md
javascript:window.location="https://cooked.wiki/"+window.location
@mislav
mislav / windows-on-mac.md
Last active February 21, 2024 23:38
Install Windows 11 in a virtual machine on macOS with an M1 CPU
View windows-on-mac.md

Based on https://docs.getutm.app/guides/windows/

  1. You will need:
    • A Windows 10 or Windows 11 license key;
    • UTM for Mac - the App Store version is offered as a way to support the developers, since it's paid, but has the same features as the free build.
  2. Obtain scripts that bootstrap an arm64 Windows 11 22H2 (I've chosen Windows Home edition and not Pro);
  3. brew install aria2 cabextract wimlib cdrtools minacle/chntpw/chntpw;
  4. cd into the directory extracted in step 1 and bash uup_download_macos.sh - this will produce an ISO;
  5. In the UTM app, create a new “Virtualize” machine and mount the ISO file from the previous step;
  6. Check “Install drivers and SPICE tools”;
View git-ssh-signing.sh
# you must also upload the public key as signing key to https://github.com/settings/keys
git config --global user.signingkey '~/.ssh/id_rsa'
git config --global commit.gpgsign true
git config --global gpg.format ssh
# (optional) this file enables `git log --show-signature` and contains email addresses associated with public keys
git config --global gpg.ssh.allowedsignersfile '~/.ssh/git-signers'
@mislav
mislav / unifi-controller-cert.sh
Last active May 20, 2022 11:42
Figuring how to assign your own SSL certificate to be used by the Unifi Controller web interface
View unifi-controller-cert.sh
hostname="MYHOST" # set this to where the Unifi Controller is served from
root_ca="rootCA.pem"
root_ca_key="rootCA.key"
cert="unifi.pem"
cert_key="unifi.key"
# these don't really matter
csr="unifi.csr"
pfx_password="whatever"
@mislav
mislav / config.json
Last active January 18, 2024 10:48
Experiment in using GitHub CLI to authenticate fetching docker images from GitHub Package Registry
View config.json
// ~/docker/config.json
{
"credsStore": "desktop",
"credHelpers": {
"docker.pkg.github.com": "gh",
"ghcr.io": "gh"
}
}
@mislav
mislav / keybindings.json
Last active June 18, 2021 12:19
VS Code keyboard shortcut for quickly re-running the Go test under development. Requires VS Code Go 0.26+
View keybindings.json
// > Preferences: Open Keyboard Shortuts (JSON)
[
{
"key": "shift+enter",
"command": "go.test.cursorOrPrevious",
"when": "editorTextFocus && editorLangId == 'go' && !findInputFocused && !replaceActive"
},
{
"key": "ctrl+shift+enter",
"command": "go.test.package"
@mislav
mislav / workflows-automerge.yml
Last active December 5, 2023 02:41
Using GitHub CLI from GitHub Actions
View workflows-automerge.yml
name: Auto-merge
on:
pull_request:
types: [opened]
jobs:
automerge:
runs-on: ubuntu-latest
View label-copy.sh
# Usage: bash label-copy.sh <source-repo> <destination-repo> <label-names>...
#
# Requirements: GitHub CLI, jq
#
# Example:
# brew install gh jq
# bash label-copy.sh owner/repo1 owner/repo2 "bug" "help wanted" "feature"
#
set -e
View die-keystone.sh
# First, close Google Chrome.
# unload the Keystone agent
find /Library/Launch* ~/Library/LaunchAgents -maxdepth 1 -iname 'com.google.*' | xargs -L1 launchctl unload
# prevent it from starting again (note: you could also back up the files by moving them elsewhere)
find /Library/Launch* ~/Library/LaunchAgents -maxdepth 1 -iname 'com.google.*' | xargs rm -v
# Warning: it's likely that running Google Chrome after this will restore these files.
# If it doesn't, consider that automatic Chrome updates will be DISABLED. Use at own risk.
@mislav
mislav / gh-rename-master
Last active April 24, 2022 10:02
Rename the default branch of a repository using GitHub CLI https://github.com/cli/cli/releases/tag/v0.10.0
View gh-rename-master
#!/bin/bash
# Usage: gh-rename-master <newbranch> [<remote>]
#
# Renames the "master" branch of the current repository both locally and on GitHub.
#
# dependencies: GitHub CLI v0.10
set -e
newbranch="${1?}"
remote="${2:-origin}"