Skip to content

Instantly share code, notes, and snippets.

Avatar

Sarah Smith sarah-j-smith

View GitHub Profile
@sarah-j-smith
sarah-j-smith / Google-Cloud-SSH.sh
Created Jan 12, 2021
Connect to Google Cloud Compute instance via SSH using OS-Login
View Google-Cloud-SSH.sh
# Creates a portable SSH key that can be offered to any GCP Compute instance you have access to, eg via Google domain login
# Pre-requisites - gcloud Google command line tool. - https://cloud.google.com/sdk/docs/quickstart
curl https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-322.0.0-darwin-x86_64.tar.gz -o google-cloud-sdk.tar.gz
open -g google-cloud-sdk.tar.gz
./google-cloud-sdk/install.sh
source ~/.bash_profile
# Setup Google login, compute zone, region and project
@sarah-j-smith
sarah-j-smith / LICENSE.txt
Last active Nov 20, 2019
Building a Qt app for Windows using IFW
View LICENSE.txt
Copyright 2019 Smithsoft Pty Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
@sarah-j-smith
sarah-j-smith / Tar pipe
Created Sep 14, 2019
The amazingly awesome tar pipe command for copying trees of files around
View Tar pipe
# https://blog.extracheese.org/2010/05/the-tar-pipe.html
# on Mac the --exclude-vcs is not available - can add --exclude .git
(cd /Users/ssmith6/depot/js-intro-workshop && tar cf - .)|(cd /Users/ssmith6/depot/Android101 && tar xvfp -)
@sarah-j-smith
sarah-j-smith / fixed-pip.sh
Created Jun 13, 2018
Fix for pip incompatibilities
View fixed-pip.sh
# This Ubuntu issue seems to be affecting Python/pip on Mac - https://github.com/beenje/script.module.requests/issues/21
# requests 2.18.2 has requirement urllib3<1.23,>=1.21.1, but you'll have urllib3 1.23 which is incompatible.
# Force the version of urllib3
pip install urllib3==1.22
@sarah-j-smith
sarah-j-smith / Python3 Virtualenv Setup.md
Last active Nov 13, 2019 — forked from pandafulmanda/Python3 Virtualenv Setup.md
TensorFlow/Python3/Jupyter Virtualenv on Mac
View Python3 Virtualenv Setup.md
@sarah-j-smith
sarah-j-smith / AppDelegate.swift
Last active Oct 20, 2017
AWS Mobile Hub + DynamoDB Low-Level API
View AppDelegate.swift
//
// AppDelegate.swift
//
import UIKit
import AWSPinpoint
import AWSAuthCore
import AWSUserPoolsSignIn
import CocoaLumberjackSwift
View Atomic bool flag in Swift 3
class Request {
// DTO that can be accessed from different threads
// Note: this is faster/better/approved by Apple instead of @synchronized and
// other constructs (even tho' its a bit more verbose). DispatchQueue by
// default is Serial so this synchronizes accesses.
private var requestStateQueue = DispatchQueue(label: "requestStateQueue")
private var _cancelled = false
/** Set to true to cancel this request - atomic/threadsafe */
var cancelled: Bool {
@sarah-j-smith
sarah-j-smith / README.md
Last active Oct 25, 2020
Simple .vimrc for Mac OSX
View README.md

To install on Mac or Windows, from a bash prompt (eg GitBash on Windows)

curl -OL https://gist.github.com/sarah-j-smith/26135fd0ecbdec02c5486dc168002cdf/raw/3df8744823fe531582c72b87a1bc8861c2adaa9c/simple-vimrc
mv simple-vimrc ~/.vimrc
@sarah-j-smith
sarah-j-smith / .bash_profile
Last active Oct 1, 2017
Simple .bashrc that creates a blue prompt line with the current path. The .bash_profile also turns on colorisation for `ls` (list files) output; and has some examples for other improvements.
View .bash_profile
source ~/.bashrc
# Have an ls that is in color by default
alias ls='ls -G '
# Use the tree command - need to install it first from here
# http://andre-als.blogspot.com.au/2012/02/how-to-install-command-tree-for-mac.html
alias tree='tree -C '
# Create a nice short cut for git logs
@sarah-j-smith
sarah-j-smith / icons.sh
Created Nov 7, 2016
Produce a set of icons for an iOS app from a PNG image.
View icons.sh
#!/bin/sh
SIZES="58 87 80 120 180 29 20 40 60 76 158 152 167"
OUTBASENAME=$(basename "$1" .png)
for sz in $SIZES; do
newImage="${OUTBASENAME}-${sz}x${sz}.png"
cp "$1" "$newImage"
sips --resampleHeightWidth $sz $sz "$newImage"