Skip to content

Instantly share code, notes, and snippets.

View squarefrog's full-sized avatar
😍
❤️ Swift

Paul Williamson squarefrog

😍
❤️ Swift
  • Cambridgeshire, UK
View GitHub Profile
@squarefrog
squarefrog / PatternMatch.swift
Created February 27, 2020 13:39
Regex warning.
import Foundation
// from https://www.hackingwithswift.com/articles/108/how-to-use-regular-expressions-in-swift
extension String {
static func ~= (lhs: String, rhs: String) -> Bool {
guard let regex = try? NSRegularExpression(pattern: rhs) else { return false }
let range = NSRange(location: 0, length: lhs.utf16.count)
return regex.firstMatch(in: lhs, options: [], range: range) != nil
}
@squarefrog
squarefrog / tempmon.sh
Last active December 13, 2019 10:41
Log CPU temperatures in Ubuntu
#!/bin/bash
#
# A script to log your CPU temps to a file.
# https://gist.github.com/squarefrog/09daf36988136ebe061601afe58f2df8
#
# You can set this script to run every X minutes using `cron`:
#
# $ sudo crontab -u username -e
#
@squarefrog
squarefrog / README.md
Created February 8, 2019 09:57
Pairing Logitech Harmony Hub with Apple TV 4/4K
  1. Add new device:
    • Entertainment Device
    • Manufacturer: Harmony Beta
    • Model: Test Apple TV
  2. Add your 'Watch Apple TV' activity
  3. From the Home screen of Harmony Hub, press the burger menu button (three lines) on the top left
  4. Harmony Setup > Add/Edit Devices & Activities > Activities > Select your Watch Apple TV activity
  5. Tap Connectivity
  6. Using your Apple TV remote, go to Settings > Remotes and Devices > Bluetooth
  7. Pair with 'Logitech Keyboard'
struct CustomData: Codable {
}
struct AmigoHelper: Codable {
var username: String? = nil
var name: String? = nil
var userID: String? = nil
var email: String? = nil
struct AmigoHelper: Codable {
var username: String? = nil
var name: String? = nil
var userID: String? = nil
var email: String? = nil
//var customData: Array<Any>? = nil
init (username: String? = nil,
name: String? = nil,
module Fastlane
module Actions
class AddIconOverlayAction < Action
def self.run(params)
#Helper.log.info "Image to overlay on icons: #{params[:overlay_image_path]}"
require 'mini_magick'
appiconset = params[:appiconset_path]
@squarefrog
squarefrog / system.log
Created September 15, 2015 11:51
Xcode 7 xctool hang log
Marker - 15 Sep 2015 12:47:34
Sep 15 12:48:11 iosdev syslogd[9211]: --- syslogd restarted ---
Sep 15 12:48:11 iosdev syslogd[9211]: Configuration Notice:
ASL Module "com.apple.authkit.asl" claims selected messages.
Those messages may not appear in standard system log files or in the ASL database.
Sep 15 12:48:11 --- last message repeated 1 time ---
Sep 15 12:48:11 iosdev syslogd[9211]: Configuration Notice:
ASL Module "com.apple.cloudd" claims selected messages.
Those messages may not appear in standard system log files or in the ASL database.
Sep 15 12:48:11 iosdev syslogd[9211]: Configuration Notice:
@squarefrog
squarefrog / alfred-query-test.py
Created June 17, 2015 13:19
Workaround for multiline Alfred input in a Python workflow
'''
Pasting in multiline text, eg:
This is
some text
fails when using the following, Alfred provided starting point.
'''
# Breaks ALL the things..
query = '{query}'
Process: Xcode [54350]
Path: /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier: com.apple.dt.Xcode
Version: 6.3.2 (7718)
Build Info: IDEFrameworks-7718000000000000~2
App Item ID: 497799835
App External ID: 812404257
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Xcode [54350]
@squarefrog
squarefrog / ViewController.swift
Last active August 29, 2015 14:19
Notification Demo
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
NSNotificationCenter.defaultCenter().addObserver(self, selector: "notificationReceived:", name: "bacon", object: nil)
var url = NSURL(string: "ashdfhfd")