Skip to content

Instantly share code, notes, and snippets.

View nehayward's full-sized avatar

Nick Hayward nehayward

View GitHub Profile
@nehayward
nehayward / Ornament.swift
Created February 16, 2024 05:18
Animate Ornament
.ornament(visibility: .visible, attachmentAnchor: .scene(.trailing), contentAlignment: .leading) {
Text("Animated Ornament")
.glassBackgroundEffect()
.offset(x: showSearch ? 0 : -400)
.offset(z: showSearch ? 0 : -64)
.animation(.spring, value: showSearch)
}
@nehayward
nehayward / Acaia.sh
Created April 12, 2020 17:18
Acaia Gatt Script
set action [lindex $argv 0];
set temp [lindex $argv 1];
set on "efdd0a0000010100"
set off "efdd0a0100000100"
set writeCommand "char-write-cmd 0x000d"
spawn gatttool -b 00:1c:97:17:fc:78 -I
sleep 3
set timeout -1
send -- "connect\r"
expect "Connection successful"
@nehayward
nehayward / kettle.sh
Created January 26, 2020 23:56
Fellow Stagg EKG+ Bluetooth control with gatttool
set action [lindex $argv 0];
set temp [lindex $argv 1];
set on "efdd0a0000010100"
set off "efdd0a0100000100"
set writeCommand "char-write-cmd 0x000d"
spawn gatttool -b 00:1C:97:16:27:13 -I
sleep 3
set timeout -1
send -- "connect\r"
expect "Connection successful"
@nehayward
nehayward / AoC_2019_Day3.swift
Created December 4, 2019 16:59
Advent of Code Day 3
#!/usr/bin/env xcrun swift
import Foundation
let input = """
R999,U626,R854,D200,R696,D464,R54,D246,L359,U57,R994,D813,L889,U238,L165,U970,L773,D904,L693,U512,R126,D421,R732,D441,R453,D349,R874,D931,R103,D794,R934,U326,L433,D593,L984,U376,R947,U479,R533,U418,R117,D395,L553,D647,R931,D665,L176,U591,L346,D199,L855,D324,L474,U251,R492,D567,L97,D936,L683,U192,R198,U706,L339,U66,R726,D102,R274,U351,R653,D602,L695,U921,R890,D654,R981,U351,R15,U672,R856,D319,R102,D234,R248,U169,L863,U375,L412,U75,L511,U298,L303,U448,R445,U638,L351,D312,R768,D303,L999,D409,L746,U266,L16,U415,L951,D763,L976,U342,L505,U770,L228,D396,L992,U3,R243,D794,L496,U611,R587,U772,L306,D119,L470,D490,L336,U518,L734,D654,L150,U581,L874,U691,L243,U94,L9,D582,L402,U563,R468,U96,L311,D10,R232,U762,R630,D1,L674,U685,R240,D907,R394,U703,L64,U397,L810,D272,L996,D954,R797,U789,R790,D526,R103,D367,R143,D41,L539,D735,R51,D172,L33,U241,R814,D981,R748,D699,L716,U647,L381,D351,L381,D121,L52,U601,R515,U713,L404,U45,R362,U670,L235,U102,R373,U966,L362,U218,R28
@nehayward
nehayward / ScanViewController.swift
Created November 18, 2019 23:26
A simple QR code scanner using Vision for iOS (Swift)
import UIKit
import Vision
import AVFoundation
import Foundation
class ScanViewController: UIViewController {
private lazy var cameraPreviewLayer: AVCaptureVideoPreviewLayer = {
let l = AVCaptureVideoPreviewLayer(session: captureSession)
l.videoGravity = .resizeAspectFill
l.connection?.videoOrientation = .portrait
echo "Hello World"
package main
import (
"bufio"
"encoding/csv"
"fmt"
"io"
"log"
"os"
"strings"
@nehayward
nehayward / AutomaticSublimeTheme.go
Created March 8, 2019 16:48
Change Sublime Theme at Sunrise/Sunset
package main
// /Users/nehayward/Library/Application Support/Sublime Text 3/Packages/User
//`"color_scheme": "Packages/Color Scheme - Default/Solarized (Light).tmTheme",`
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
@nehayward
nehayward / sunset.go
Created March 8, 2019 02:34
Get Sunset Time
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"time"
)
@nehayward
nehayward / helloWorld.swift
Created March 8, 2019 01:54
Swift Script Template
#!/usr/bin/env xcrun swift
print("Hello World")