Skip to content

Instantly share code, notes, and snippets.

View resuna's full-sized avatar

Peter da Silva resuna

View GitHub Profile
@resuna
resuna / tcolor.tcl
Created March 18, 2023 14:00
Tcl script using osascript to set and read Terminal.app colors
#!/usr/bin/tclsh8.5
package require md5
set script {
tell application "Terminal"
tell %s
set the background color to { %s }
end tell
%s
end tell
class ParkBenchTimer {
let startTime:CFAbsoluteTime
var endTime:CFAbsoluteTime?
init() {
startTime = CFAbsoluteTimeGetCurrent()
}
func stop() -> CFAbsoluteTime {
@resuna
resuna / pcg32.swift
Last active February 25, 2018 20:02
import Cocoa
// *Really* minimal PCG32 code / (c) 2014 M.E. O'Neill / pcg-random.org
// Licensed under Apache License 2.0 (NO WARRANTY, etc. see website)
// Converted to Swift by Peter da Silva, backing out some C optimizations
// and hardcoding Knuth's LCG parameters
class pcg32_random {
var state: UInt64;
// Defn of ClientData:
// #ifndef _CLIENTDATA
// # ifndef NO_VOID
// typedef void *ClientData;
// # else
// typedef int *ClientData;
// # endif
// # define _CLIENTDATA
// #endif