Skip to content

Instantly share code, notes, and snippets.

View sarah-j-smith's full-sized avatar

Sarah Smith sarah-j-smith

View GitHub Profile
@sarah-j-smith
sarah-j-smith / icons.sh
Created November 7, 2016 10:53
Produce a set of icons for an iOS app from a PNG image.
#!/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"
@sarah-j-smith
sarah-j-smith / scaleToWidth
Last active November 9, 2016 02:07
Create SD, Retina and @3x Images of a given size.
#!/bin/sh
filename=$(basename "$1")
extension="${filename##*.}"
filename="${filename%.*}"
if [ -z $1 ]; then
echo "Usage: $0 image.png <points wide>"
echo " produces 3 copies of the image, in SD, @2x and @3x for that point size"
exit;
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 {
QString MacUtils::getOpenFileName(QWidget *parent, const QString &title, const QString &dirName, const QString &filter, MacUtils::OpenType openType)
{
qDebug() << Q_FUNC_INFO << "dirName:" << dirName;
NSOpenPanel *panel = [NSOpenPanel openPanel];
QWidget *window = parent->window();
Q_ASSERT_X(window != 0, Q_FUNC_INFO, "Expected non-nil window");
Q_ASSERT_X(window->isWindow(), Q_FUNC_INFO, "Expected window");
NSView *v = reinterpret_cast<NSView *>(window->winId());
NSWindow *macWindow = [v window];
@sarah-j-smith
sarah-j-smith / AppDelegate.swift
Last active October 20, 2017 07:16
AWS Mobile Hub + DynamoDB Low-Level API
//
// AppDelegate.swift
//
import UIKit
import AWSPinpoint
import AWSAuthCore
import AWSUserPoolsSignIn
import CocoaLumberjackSwift
@sarah-j-smith
sarah-j-smith / fixed-pip.sh
Created June 13, 2018 01:36
Fix for pip incompatibilities
# 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 November 13, 2019 03:43 — forked from pandafulmanda/Python3 Virtualenv Setup.md
TensorFlow/Python3/Jupyter Virtualenv on Mac
@sarah-j-smith
sarah-j-smith / LICENSE.txt
Last active November 20, 2019 07:24
Building a Qt app for Windows using IFW
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 / .bash_profile
Last active July 2, 2021 02:17
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.
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 / README.md
Last active July 18, 2021 06:39
Clean Secrets from a Repo

Cleaning Secrets from a Repo

FIRST: Revoke the secrets from whatever assets or platform they provide access to

Assume that the keys have already fallen in to the hands of bad actors, and immediately change the locks so that the keys are no use.