Skip to content

Instantly share code, notes, and snippets.

dragon788 dragon788

  • Midwest, USA
View GitHub Profile
@dragon788
dragon788 / crostini-libvirt-vagrant.md
Last active Jun 17, 2020
Crostini libvirt tips and tricks
View crostini-libvirt-vagrant.md

libvirt tweaks for Crostini

Important bits

sudo apt install virt-manager # includes libvirt/virsh/etc

curl -L https://vagrantup.com/whatever/vagrant-version.deb
sudo dpkg -i vagrant*.deb

For the vagrant-libvirt plugin you may need to use an alternate ruby/vagrant path in the call to install the plugin.

@dragon788
dragon788 / reset-libvirt-qemu-kvm-tablet-input.sh
Created Mar 18, 2020
Sometimes the mouse cursor stops responding or two finger scrolling doesn't work, this quick reset fixes that
View reset-libvirt-qemu-kvm-tablet-input.sh
virsh detach-device --domain macOS-Simple-KVM --live --conf
ig <( cat << 'EOF'
<input type='tablet' bus='usb'>
<alias name='input3'/>
<address type='usb' bus='0' port='2'/>
</input>
EOF
)
sleep 2
virsh attach-device --domain macOS-Simple-KVM --live --conf
@dragon788
dragon788 / !readme.md
Last active Feb 27, 2020
Clear Linux basic setup
View !readme.md

Setting up Clear Linux with i3 and Yubikey bits

See [bootstrap.sh] for quickest swupd package bundle installation.

If you are tricksy you can curl the raw [bootstrap.sh] file and examine it and then chmod +x bootstrap.sh and run it yourself.

The bootstrap currently doesn't automatically force you into i3, but if you log out and select your user from the login screen and click the ⚙️ icon and select i3 from the list, then enter your password if you didn't already and login.

@dragon788
dragon788 / gist:b255a12f019ffc4274ff1f1c64861a81
Created Feb 9, 2020
TFTP boot for openwrt / GLiNet / LEDE and Clear Linux
View gist:b255a12f019ffc4274ff1f1c64861a81
tee -a /etc/dnsmasq.conf << EOF
dhcp-match=set:ipxeclient,60,IPXEClient*
dhcp-match=set:bios,60,PXEClient:Arch:00000
dhcp-boot=tag:bios,netboot.xyz.kpxe,,192.168.8.1
dhcp-match=set:efi32,60,PXEClient:Arch:00002
dhcp-boot=tag:efi32,netboot.xyz.efi,,192.168.8.1
dhcp-match=set:efi32-1,60,PXEClient:Arch:00006
dhcp-boot=tag:efi32-1,netboot.xyz.efi,,192.168.8.1
dhcp-match=set:efi64,60,PXEClient:Arch:00007
dhcp-boot=tag:efi64,netboot.xyz.efi,,192.168.8.1
@dragon788
dragon788 / !notes.md
Created Jan 5, 2020
Getting a PiVPN profile working on GL.iNet GL-AR-750S
View !notes.md

If you've used the PiVPN scripts to generate a profile and protected your private key with a passphrase (a very good practice), then you will need a way to decrypt this during the "non-interactive" OpenVPN connection on the router.

The option that I used that worked was to create a separate file that could be referenced in the profile by adding an askpass option that contains only the passphrase.

https://stackoverflow.com/a/24071181/3794873

I'm planning to also test with a dummy empty .pass file since it seems like maybe the OpenVPN profile upload in the GL.iNet firmware doesn't realize that the PiVPN generated ovpn profile has an encrypted private key so it doesn't prompt for one until it sees multiple files in a zip. If you upload a zip that contains the ovpn profile and another file, it seems to assume that the other file is a key or certificate that might need a passphrase so it requests one after the upload.

@dragon788
dragon788 / vagrant_packer_windows.md
Last active Nov 26, 2019
Cheap Windows VM alternate version
View vagrant_packer_windows.md

Consistent, Repeatable, Scriptable

If you've ever heard (or uttered), the phrase "but it works on my machine", then you have experienced one of the most common and pervasive challenges of distributed development. Since you are here you probably have a desire to overcome this common challenge of distributed development, ie having a consistent build environment that works the same way on a developer's machine as it does in the build system (Azure DevOps/Jenkins/GitLab CI/etc).

If the above paragraph has you convinced, TL;DR to the magic!

There have been many ways to work towards repeatable builds, here are a few.

  • CocoaPods (iOS dependency package management)
  • Nuget packages (.NET dependencies)
  • package-lock.json (npm/yarn for Javascript dependencies)
@dragon788
dragon788 / cheap_windows_dev.md
Last active Nov 23, 2019
"Quickly" getting a Windows VM setup for dev and testing using free tools and evaulation licenses
View cheap_windows_dev.md

Modern.ie is behind the times, Microsoft/EdgeOnWindows on the VagrantUp box site is WAY out of date, what's a guy to do? Build your own!

Now to build these you'll need Packer and the virtualization tool you are building the box for, Virtualbox or VMware Workstation (or Parallels on Mac). Packer is written in Go and doesn't really require any external dependencies. If you are on Linux you can possibly find Packer in your package management tool, but it is best to grab the latest binary from https://packer.io and extract it to /usr/local/bin/ as packer or put it in ~/.local/bin/ if you have that in your PATH variable. On macOS use Homebrew from https://brew.sh to install with brew install packer. On W

curl -L https://releases.hashicorp.com/packer/1.4.5/packer_1.4.5_linux_amd64.zip -o ~/Downloads/packer.zip
unzip packer.zip
sudo install -m 755 packer /usr/local/bin/ # Allows any user to run it
sudo apt install virtualbox # or grab it from the https://virtualbox.org website

Go

@dragon788
dragon788 / kill_me_now.md
Created Nov 6, 2019
Create Win10 bootable USB media from macOS without wanting to kill yourself and everyone around you
View kill_me_now.md

Kill Me NOW

Because Apple doesn't support NTFS but Linux does and Microsoft has gotten their WIM really fat in newer versions (but don't nicely split it into pieces for you to keep them under 4GB so they could fit on a FAT32 drive), we have do some fun crazy workarounds.

Both of these are close, one isn't optimal because it extracts from the iso rather than loop mounting. The other used to be valid but once the install.wim got over 4GB it started failing.

References

https://techbit.ca/2019/02/creating-a-bootable-windows-10-uefi-usb-drive-using-linux/ https://www.freecodecamp.org/news/how-make-a-windows-10-usb-using-your-mac-build-a-bootable-iso-from-your-macs-terminal/

@dragon788
dragon788 / win10_binary_fission.md
Last active Jul 7, 2020
Making the Windows 10 "chubby" install.wim compatible with a FAT32 USB so a UEFI bootable USB can be created from Linux/macOS/ChromeOS
View win10_binary_fission.md

MAGIC aka Making Anything Gruelingly "Impossible" Coherent

Whatever operating system you are using to create the USB, you will need to have a Windows 10 ISO, either from Microsoft or your system manufacturer and have a USB drive 8GB or larger (or one with at least 5GB of free space and using the FAT32 filesystem, but using a fresh and empty one is best).

Problem statement (Your biggest problem is you need Windows... but who am I to judge?)

You probably stumbled across this post because you got an error trying to use Unetbootin or 7zip or hdiutil and diskutil or Disk Utility when trying to make a bootable Windows USB. This might have been E_FAIL from p7zip/7zip, or a hard to spot error in the logs when you cp or 7z x the entire contents of the ISO over to a FAT32 USB. Since FAT32 can only handle files up to 4GB (it truncates anything larger), the "fluffy" install.wim that exceeds this limit gets corrupted and results in a USB that you can boot from, but fails partway through attempting t

@dragon788
dragon788 / win10_binary_fission.md
Created Nov 2, 2019
Making the Windows 10 "fluffy" install.wim compatible with a FAT32 USB so a UEFI bootable USB can be created from Linux/macOS/ChromeOS
View win10_binary_fission.md

MAGIC aka Making Anything Gruelingly "Impossible" Coherent

Whatever operating system you are using to create the USB, you will need to have a Windows 10 ISO, either from Microsoft or your system manufacturer and have a USB drive 8GB or larger (or one with at least 5GB of free space and using the FAT32 filesystem, but using a fresh and empty one is best).

Assumptions (yes I know what assume does to do U and Me)

  1. You have an ISO downloaded to $HOME/Downloads/Win10_1903_V2_English_x64.iso or your native language equivalent.
  2. You have a USB drive you have formatted with FAT32, either using "Files" in ChromeOS or Disk Utility or Gparted or the command line equivalents (fdisk, mkfs.fat32, and/or parted) in Linux or the Disk Utility or the command line diskutil in macOS or just formatting the drive by right clicking and doing "Format" in Windows... but why aren't you using the Microsoft tool if you have Windows available (maybe you like doing it the "hard" way to learn more about how things work?).
You can’t perform that action at this time.