Skip to content

Instantly share code, notes, and snippets.

View maxchuquimia's full-sized avatar

Max Chuquimia maxchuquimia

  • Sydney, Australia
View GitHub Profile
@MainasuK
MainasuK / ScreenRecordHelper.swift
Last active January 26, 2021 06:01
Screen Record Permission Request Helper for macOS Catalina
let stream = CGDisplayStream(display: CGDirectDisplayID(), outputWidth: 1, outputHeight: 1, pixelFormat: Int32(kCVPixelFormatType_32BGRA), properties: nil, handler: { (status, time, surface, update) in
// do nothing
})
https://youtu.be/-C-JoyNuQJs?t=39m45s
When I put the reference implementation onto the website I needed to
put a software license on it.
And I looked at all the licenses that were available, and there were a lot
of them. And I decided that the one I liked the best was the MIT License,
which was a notice that you would put on your source and it would say,
"you're allowed to use this for any purpose you want, just leave the
notice in the source and don't sue me."
# create an UDP server using nc on port 11090
nc -ul 11090
# check whether an UDP server is listening on 11190
nc -vz -u <hostname> 11090
# send a packet to the UDP server
echo -n "hello" | nc -4u -w1 <hostname> 1118
@epohs
epohs / ncurses.swift
Last active July 7, 2020 01:23
How to setup and use ncurses in a Swift script
#!/usr/bin/env xcrun swift -i
import Foundation
import Darwin.ncurses
initscr() // Init window. Must be first
cbreak()
noecho() // Don't echo user input
nonl() // Disable newline mode
intrflush(stdscr, true) // Prevent flush
@cmittendorf
cmittendorf / LocateMe.swift
Created April 23, 2015 07:32
A command line tool for Mac OS X written in Swift that uses CoreLocation for reverse geocoding a location from latitude and longitude. The geocoding part of this script will work on OS X as well as iOS.
#!/usr/bin/env swift
// Run this command line tool as a dynamic script or compile a binary
// using the following command:
// swiftc -sdk `xcrun --show-sdk-path` LocateMe.swift
import Cocoa
import CoreLocation
extension String {
@irace
irace / wwdc.swift
Created April 21, 2015 17:55
Randomly pick a deserving team member to give your WWDC ticket too. Allows for weighting in case you like some more than others.
#!/usr/bin/env xcrun swift
import Foundation
struct Teammate {
let name: String
let weighting: Int
}
let teammates = [