Skip to content

Instantly share code, notes, and snippets.

View adamyonk's full-sized avatar
👨‍💻
✌️

Adam Jahnke adamyonk

👨‍💻
✌️
View GitHub Profile
@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

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”;
@a7madgamal
a7madgamal / Change Do not disturb DND setting on Macos Big Sur using the terminal.md
Last active July 29, 2023 22:24
Change Do not disturb DND setting on Macos Big Sur using the terminal

defaults read com.apple.ncprefs.plist dnd_prefs

turn on: defaults write com.apple.ncprefs.plist dnd_prefs -data 62706C6973743030D60102030405060708080A08085B646E644D6972726F7265645F100F646E64446973706C6179536C6565705F101E72657065617465644661636574696D6543616C6C73427265616B73444E445875736572507265665E646E64446973706C61794C6F636B5F10136661636574696D6543616E427265616B444E44090808D30B0C0D070F1057656E61626C6564546461746556726561736F6E093341C2B41C4FC9D3891001080808152133545D6C828384858C9499A0A1AAACAD00000000000001010000000000000013000000000000000000000000000000AE

turn off: defaults write com.apple.ncprefs.plist dnd_prefs -data 62706C6973743030D5010203040506070707075B646E644D6972726F7265645F100F646E64446973706C6179536C6565705F101E72657065617465644661636574696D6543616C6C73427265616B73444E445E646E64446973706C61794C6F636B5F10136661636574696D6543616E427265616B444E44090808080808131F3152617778797A7B0000000000000101000000000000000B0000000000000000000000000000007C

@kristijanhusak
kristijanhusak / 1. Toggle-kitty-and-neovim-colors.md
Last active March 6, 2024 18:15
Toggle between light and dark colorschemes for both neovim and kitty

Requirements:

  • Neovim v0.4+
  • Python 3.4+ and pynvim
  • Kitty
  • Zsh, but would probably work with any shell if configured properly
  • Your favorite dark and light colorschemes

Installation

  1. Add below python script to ~/.config/kitty/ folder. Make sure to make it executable (chmod +x ~/.config/kitty/colors)
  2. Set up your dark/light colorscheme, and where to store kitty colors configuration (line 4 to 9)
@tj
tj / remap.sh
Created March 4, 2020 13:31
Remap tilde and left shift on a UK keyboard
hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000035,"HIDKeyboardModifierMappingDst":0x7000000E1}, {"HIDKeyboardModifierMappingSrc":0x700000064,"HIDKeyboardModifierMappingDst":0x700000035}]}'
cat << 'EOF' > ~/.keymappings && chmod +x ~/.keymappings
hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000035,"HIDKeyboardModifierMappingDst":0x7000000E1}, {"HIDKeyboardModifierMappingSrc":0x700000064,"HIDKeyboardModifierMappingDst":0x700000035}]}'
EOF
sudo /usr/bin/env bash -c "cat > /Library/LaunchDaemons/org.custom.keymappings.plist" << EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
# GIT heart FZF
# -------------
is_in_git_repo() {
git rev-parse HEAD > /dev/null 2>&1
}
fzf-down() {
fzf --height 50% --min-height 20 --border --bind ctrl-/:toggle-preview "$@"
}
@gbaman
gbaman / HowToOTGFast.md
Last active July 11, 2024 00:00
Simple guide for setting up OTG modes on the Raspberry Pi Zero, the fast way!

Setting up Pi Zero OTG - The quick way (No USB keyboard, mouse, HDMI monitor needed)

More details - http://blog.gbaman.info/?p=791

For this method, alongside your Pi Zero, MicroUSB cable and MicroSD card, only an additional computer is required, which can be running Windows (with Bonjour, iTunes or Quicktime installed), Mac OS or Linux (with Avahi Daemon installed, for example Ubuntu has it built in).
1. Flash Raspbian Jessie full or Raspbian Jessie Lite onto the SD card.
2. Once Raspbian is flashed, open up the boot partition (in Windows Explorer, Finder etc) and add to the bottom of the config.txt file dtoverlay=dwc2 on a new line, then save the file.
3. If using a recent release of Jessie (Dec 2016 onwards), then create a new file simply called ssh in the SD card as well. By default SSH i

@drio
drio / pi.markdown
Last active August 29, 2015 14:22

Notes on using a Raspberry Pi as a thermostat

Here you have some notes and comments on my experiences when setting up a raspberry pi as a thermostat.

I'll expand the document as more questions arise, but I will keep it short initially.

Materials

@nolanlawson
nolanlawson / protips.js
Last active February 4, 2024 18:06
Promise protips - stuff I wish I had known when I started with Promises
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");
@paulirish
paulirish / bling.js
Last active July 3, 2024 20:45
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
}
NodeList.prototype.__proto__ = Array.prototype;
@henrik
henrik / .gitignore
Last active August 29, 2015 14:06
show_screenshot helper for PhantomJS tests.
public/screenshot-*.png