- Create a gist if you haven't already.
- Clone your gist:
# make sure to replace `<hash>` with your gist's hash git clone https://gist.github.com/<hash>.git # with https git clone git@gist.github.com:<hash>.git # or with ssh
| # Generate a BaseSystem.dmg with 10.13 Install Packages | |
| hdiutil attach /Applications/Install\ macOS\ 10.13\ Beta.app/Contents/SharedSupport/InstallESD.dmg -noverify -mountpoint /Volumes/highsierra | |
| hdiutil create -o /tmp/HighSierraBase.cdr -size 7316m -layout SPUD -fs HFS+J | |
| hdiutil attach /tmp/HighSierraBase.cdr.dmg -noverify -mountpoint /Volumes/install_build | |
| asr restore -source /Applications/Install\ macOS\ 10.13\ Beta.app/Contents/SharedSupport/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase | |
| cp -R /Volumes/highsierra/Packages /Volumes/OS\ X\ Base\ System/System/Installation | |
| hdiutil detach /Volumes/OS\ X\ Base\ System/ | |
| hdiutil detach /Volumes/highsierra/ | |
| mv /tmp/HighSierraBase.cdr.dmg /tmp/BaseSystem.dmg |
| #!/bin/bash | |
| echo "Getting list of Availability Zones" | |
| all_regions=$(aws ec2 describe-regions --output text --query 'Regions[*].[RegionName]' | sort) | |
| all_az=() | |
| while read -r region; do | |
| az_per_region=$(aws ec2 describe-availability-zones --region $region --query 'AvailabilityZones[*].[ZoneName]' --output text | sort) | |
| while read -r az; do |
| #!/usr/bin/env python3 | |
| # by dotfloat | |
| # complaints go to dotfloat at gmail dot com | |
| # Running: | |
| # You need to have 'python3' and 'python3-gi' installed. | |
| # | |
| # On Debian/Ubuntu and derivatives, you have to run this: | |
| # $ sudo apt-get install python3 python3-gi |
Incorporates changes by 0mnius.
The intent is to define terse, standards-supported names for AWS regions.
When Swift was first announced, I was gratified to see that one of the (few) philosophies that it shared with Objective-C was that exceptions should not be used for control flow, only for highlighting fatal programming errors at development time.
So it came as a surprise to me when Swift 2 brought (What appeared to be) traditional exception handling to the language.
Similarly surprised were the functional Swift programmers, who had put their faith in the Haskell-style approach to error handling, where every function returns an enum (or monad, if you like) containing either a valid result or an error. This seemed like a natural fit for Swift, so why did Apple instead opt for a solution originally designed for clumsy imperative languages?
I'm going to cover three things in this post:
| apt-get clean autoclean | |
| apt-get autoremove --yes | |
| rm -rf /var/lib/{apt,dpkg,cache,log}/ |
| /** | |
| * Advanced Window Snap | |
| * Snaps the Active Window to one of nine different window positions. | |
| * | |
| * @author Andrew Moore <andrew+github@awmoore.com> | |
| * @version 1.0 | |
| */ | |
| /** | |
| * SnapActiveWindow resizes and moves (snaps) the active window to a given position. |
From This other answer on the same thread
Based on Chris Johnsen's answer:
I added this line to the [alias] section of my git config file (~/.gitconfig):
squash = "!f(){ git reset --soft HEAD~${1} && git commit --edit -m\"$(git log --format=%B --reverse HEAD..HEAD@{1})\"; };f"
| #!/bin/bash | |
| # Bonjour name ending in .local | |
| scutil --set LocalHostName "My-iMac" | |
| # Friendly name shown in System Preferences > Sharing | |
| scutil --set ComputerName "My-iMac" | |
| # The name recognized by the hostname command | |
| scutil --set HostName "My-iMac" | |
| # Save the computer's serial number in a variable so it can be used in the next command. | |
| serialNum=$(ioreg -l | awk '/IOPlatformSerialNumber/ { split($0, line, "\""); printf("%s\n", line[4]); }') | |
| # Set the NetBIOS name as the serial number |