Skip to content

Instantly share code, notes, and snippets.

Ethan Spoelstra espoelstra

Block or report user

Report or block espoelstra

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@espoelstra
espoelstra / azure-pipelines.yml
Last active Apr 2, 2019
Azure DevOps Docker for Mac installation
View azure-pipelines.yml
pool:
vmImage: 'macOS-10.13'
steps:
- bash: |
brew cask install docker # grabs Docker for Mac
set -x
echo "Running xattr" # I think brew is supposed to do this but I was still prompted to "trust" it if I didn't
xattr -d -r com.apple.quarantine /Applications/Docker.app
echo "Running Docker as root to install helpers"
@espoelstra
espoelstra / README.md
Last active Apr 2, 2019 — forked from fkorotkov/nanka.xml
Use the xml to enabled nested virtualization with the Anka command line installation instructions like `sudo installer -applyChoiceChangesXML nanka.xml -pkg AnkaBuild-1.4.3.104.pkg -target /`
View README.md

README

Save this XML somewhere like $HOME/Downloads alongside the Anka .pkg file. Install/reinstall using this xml to enabled nested virtualization with the Anka command line installation instructions:

  • sudo installer -applyChoiceChangesXML nanka.xml -pkg AnkaBuild-1.4.3.104.pkg -target / If your hardware supports things properly, you should be able to install Docker for Mac inside the VM and use it.
@espoelstra
espoelstra / fix-desktop-launcher.sh
Created Feb 6, 2019 — forked from stuaxo/fix-desktop-launcher.sh
Launch desktop files instead of opening them in gedit.
View fix-desktop-launcher.sh
$ sudo apt-get install dex
$ /usr/bin/dex -c /usr/bin/dex -t ~/.local/share/applications/
@espoelstra
espoelstra / !notes.md
Last active Feb 8, 2019
Jetbrains IntelliJ IDEA RubyMine WebStorm PhpStorm PyCharm HiDPI on ChromeOS experiments
View !notes.md

Finding optimal settings for rapidly scalable ChromeOS UI

Official documentation

https://www.reddit.com/r/Crostini/wiki/howto/adjust-display-scaling

"Best" method in Chrome v73+

The BEST way to do this in ChromeOS is to right click the application icon and choose "Use low density", then either allow ChromeOS to restart the app or say "Not now" and do it yourself. Upon starting the application again you should have a readable UI without monkeying with the Java VM options or the properties of whichever app your are using.

@espoelstra
espoelstra / .moving-domain-joined-drives.md
Last active Oct 1, 2018
Moving hard drive between computers when joined to an AD/SSSD domain
View .moving-domain-joined-drives.md

When imaging a computer to speed up the process and avoid prompts but also prevent duplicate names on the network, you will typically configure your image to pull out some unique identifier from the hardware and use that as part of the hostname. This could be the system serial number or the MAC address of the on board network controller (highly unlikely to change without a new motherboard) or something else like that.

The trouble with moving a hard drive that has been imaged this way is that it doesn't magically adopt the unique attributes from the new system, and if you reimage the old system with another drive, there is now an "evil" twin on the network, which causes no end of fun and frivolity when suddenly one becomes untrusted and you can't log into any AD accounts from it.

The solution is that immediately after moving the drive to a new computer, you should login, then unjoin the domain (requires domain admin permissions) so you can rename and rejoin once you know what unique identifier you will use i

@espoelstra
espoelstra / .bats-advice.md
Created Sep 30, 2018
Bats testing advice, pitfalls, and behaviors to watch out for
View .bats-advice.md

You can test almost anything with Bats, assuming it accepts input and produces output or an exit code. Bats is commonly used to test scripts, but it can also be used to wrap characterization or integration tests or API "contract" tests around an executable (eg run my-thing.bin -h ; assert_exit_code == 0 or to run a series of commands and test the results across various parts of the system (eg docker ps | grep bats ; assert_line 'bats/bats:latest').

When testing a shell script with bats there are multiple ways to perform the tests. You can do a "blackbox" style run my-script.sh --some option --other-flag and assert certain outputs and status codes and check for the presence or absence of temporary files in /tmp (if it was supposed to create or clean them up), or the absence of oh-poop.log files if the script triggers logging when it hits an error. Or you can do individual function testing and examine the environment variables after executing individual functions to check for any state that you are t

@espoelstra
espoelstra / .bats-mock-SO.md
Last active Sep 30, 2018
Bats-mock which to use?
View .bats-mock-SO.md
@espoelstra
espoelstra / .freedos-pxe-boot.md
Created Sep 26, 2018
Creating a FreeDOS image for PXE boot
View .freedos-pxe-boot.md

FreeDOS easy to update USB or PXE boot (Legacy or EFI)

I've been wanting to do this for quite a while, ever since I had to make up dozens of USB drives with a system image for deployment to migrate from Windows XP to Windows 7 for a large enterprise. Any tweaks to the image required re-writing all the drives, and the quickest way to burn up a cheap drive is repeated reads and writes. Then I learned partway through the rollout from the support staff performing the hands-on reimaging that on some systems the boot took forever, and while investigating I discovered that there was a BIOS update that remedied the issue and the system boot dropped from 10-15 minutes to a minute or two. After that I added updating the BIOS to our reimage procedure checklist, but again I was making multiple copies of the USB so that each tech could have one to do the fairly quick BIOS update before switching over to the other USB for imaging the system. Luckily at the time I had opted for the USB "full" image of FreeDOS which had sp

View !powershell-hijinks.md

If wanting to run a .ps1 with a double click it IS possible to edit the registry to allow this, the issue is that scripts that aren't elevated may fail, and it bypasses some of the ExecutionPolicy restrictions or hardcodes the same policy for all of them.

This Q&A has a number of options for making it work, but the best practice scenario I'm going with is creating a .bat file to call a .ps1 file, and then putting a shortcut to the .bat file on the Public Desktop so that the shortcut can be set to run as Administrator and prompt for the password if UAC is configured that way.

https://stackoverflow.com/questions/10137146/is-there-any-way-to-make-powershell-script-work-by-double-clicking-ps1-file

For reference the "Run with PowerShell" in the right click menu uses this as the "Command" registry key, "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" "-Command" "if((Get-ExecutionPolicy ) -ne 'AllSigned') { Set-ExecutionPolicy -Scope Process Bypass }; & '%1'"

If a user has changed the association

@espoelstra
espoelstra / !BashMadness.md
Created Aug 31, 2018
As a Bash scripter, I want to be able to handle required positional parameters without updating my $# compare to see if enough were supplied constantly
View !BashMadness.md

Bash Madness

This was conceived out of a desire to avoid if [ -z $1 ]; then echo "SomeVar required"; exit 1; fi for all the positionals since the number I want to handle might change. Eventually it may handle shift and named or - or -- delimited arguments, but we are starting of simple slow.

You can’t perform that action at this time.