Skip to content

Instantly share code, notes, and snippets.

View dragon788's full-sized avatar

dragon788 dragon788

View GitHub Profile
@dragon788
dragon788 / gist:b255a12f019ffc4274ff1f1c64861a81
Created February 9, 2020 21:03
TFTP boot for openwrt / GLiNet / LEDE and Clear Linux
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 January 5, 2020 01:10
Getting a PiVPN profile working on GL.iNet GL-AR-750S

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 November 26, 2019 18:30
Cheap Windows VM alternate version

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 November 23, 2019 04:11
"Quickly" getting a Windows VM setup for dev and testing using free tools and evaulation licenses

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 November 6, 2019 17:23
Create Win10 bootable USB media from macOS without wanting to kill yourself and everyone around you

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 April 19, 2024 09:26
Making the Windows 10 "chubby" install.wim compatible with a FAT32 USB so a UEFI bootable USB can be created from Linux/macOS/ChromeOS

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).

TL;DR

#macOS/Linux
# First try the `bootiso` program, it has options for splitting the WIM for you!
# https://jsamr.github.io/bootiso/
# You need to already have 7zip aka `p7zip` on macOS and Linux, and `wimlib` macOS via `brew` or `wimtools` on Linux
@dragon788
dragon788 / win10_binary_fission.md
Created November 2, 2019 03:23
Making the Windows 10 "fluffy" install.wim compatible with a FAT32 USB so a UEFI bootable USB can be created from Linux/macOS/ChromeOS

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?).
@dragon788
dragon788 / f_hjkl_movements.json
Created September 16, 2019 18:07 — forked from pirj/f_hjkl_movements.json
Karabiner complex modiications: Vi'ish mode
{
"title": "F + HJKL",
"rules": [
{
"description": "Vi'ish Mode [F as Trigger Key]",
"manipulators": [
{
"type": "basic",
"parameters": {
"basic.to_delayed_action_delay_milliseconds": 150,
@dragon788
dragon788 / python-awesome-dd.py
Created April 25, 2019 04:25
Run with `python python-awesome-dd.py help` to get usage info, I find this far more reliable than Etcher/et al for writing images
#!/usr/bin/env python
#
# Copyright (c) 2014, Mike 'Fuzzy' Partin <fuzzy@fu-manchu.org>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
@dragon788
dragon788 / powerfile.py
Created October 20, 2018 14:10
Powerfile C200 Python from Google groups
from pywin.mfc import dialog, window, activex
import win32ui, win32uiole, win32con, win32file
import os, sys, win32api, glob, time, pywintypes
from win32com.client import gencache
import discinfo
# c200
c200_typelib = '{E9A61682-5978-11D3-B313-00C04F7654DB}'
c200_clsid = '{61A3F5A5-594F-11D3-B313-00C04F7654DB}'