Skip to content

Instantly share code, notes, and snippets.

View MattCheetham's full-sized avatar

Matthew Cheetham MattCheetham

View GitHub Profile
@kyleturner
kyleturner / Remove Submodule
Created January 5, 2012 01:07
How to remove a submodule from a Github project
To remove a submodule you need to:
Delete the relevant line from the .gitmodules file.
Delete the relevant section from .git/config.
Run git rm --cached path_to_submodule (no trailing slash).
Commit and delete the now untracked submodule files.
@armstrongnate
armstrongnate / basic-auth.swift
Created July 20, 2014 21:45
HTTP Basic Authentication using NSURLSession in swift
import Foundation
let config = NSURLSessionConfiguration.defaultSessionConfiguration()
let userPasswordString = "username@gmail.com:password"
let userPasswordData = userPasswordString.dataUsingEncoding(NSUTF8StringEncoding)
let base64EncodedCredential = userPasswordData!.base64EncodedStringWithOptions(nil)
let authString = "Basic \(base64EncodedCredential)"
config.HTTPAdditionalHeaders = ["Authorization" : authString]
let session = NSURLSession(configuration: config)
@loganwright
loganwright / Shell.swift
Last active November 12, 2016 10:46
Call shell commands from Swift
func shell(input: String) -> (output: String, exitCode: Int32) {
let arguments = split(input, maxSplit: Int.max, allowEmptySlices: true) {
$0 == " "
}
let task = NSTask()
task.launchPath = "/usr/bin/env"
task.arguments = arguments
task.environment = [
"LC_ALL" : "en_US.UTF-8",
@steipete
steipete / gist:12c73d1b4dc1e933e15d
Last active June 26, 2019 22:48
Since some asked, these are the specs for my new hell machine. (https://twitter.com/steipete/status/697675524286627840). I got most of the parts on Amazon, keep an eye out for their warehouse deals, great savings for usually just damaged boxes.
Fractal Design Define S Black
Corsair CP-9020094-EU RMX Serie RM1000X ATX/EPS (if you don't do SLI 850W is good enough)
Asus ROG Maximus VIII Hero Gaming Mainboard
Corsair CMK32GX4M4A2400C14 Vengeance LPX 32GB
Intel Core™ i7-6700K
Noctua NH-D15S
Samsung Basic MZ-7KE1T0BW 850 Pro SSD (no space for an PCI-E version...)
Western Digital WD40EZRX Caviar Green 4TB (optional)
@zwaldowski
zwaldowski / Extra Logging for My Great App.mobileconfig
Last active January 19, 2024 00:35
Apple Configuration Profile for Logging in iOS 10 and macOS Sierra
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<!-- iOS 10, macOS Sierra, and friends bring a new logging subsystem that's
supposed to scale from the kernel, up to frameworks, and up to apps. It defaults
to a more regimented, privacy-focused approach that large apps and complex
systems need.
It, along with Activity Tracing introduced in iOS 8 and macOS Yosemite and the
Console app in macOS Sierra, hope to help you graduate from caveman debugging to
enum Zodiac: String {
case aries, taurus, gemini, cancer, leo, virgo, libra, scorpio, sagittarius, capricorn, aquarius, pisces
}
extension Zodiac {
var dateRangeString: String {
let df = DateFormatter()
df.dateFormat = "MMM d"
let from = df.string(from: dateRange.lowerBound)
let to = df.string(from: dateRange.upperBound)
@emmanuelkehinde
emmanuelkehinde / DropdownSelector.swift
Created May 16, 2021 20:25
Reusable Dropdown selector using SwiftUI + Overlapping displaying using zIndex()
import SwiftUI
struct DropdownOption: Hashable {
let key: String
let value: String
public static func == (lhs: DropdownOption, rhs: DropdownOption) -> Bool {
return lhs.key == rhs.key
}
}
@lksnyder0
lksnyder0 / hue-remote-dimmer-january-2022.yaml
Last active July 6, 2023 04:19 — forked from codycodes/hue-remote-dimmer-december-2021.yaml
Blueprint to create Home Assistant automations based on Hue Remote Dimmer Button Press/Holds (created using the RWL020 dimmer)
blueprint:
name: Hue Dimmer Remote With Hold
description: |
(Jan 2022 Update) Using a Hue bridge with which a dimmer remote is paired, allows you to configure actions based on said Hue Dimmer Remote
NOTE: tested with RWL020 but may also work with RWL021
domain: automation
source_url: https://gist.github.com/lksnyder0/6ad7bd5db9201f1c26019beb8bbb0ee7
input:
dimmer_device:
name: Dimmer Remote Device