Skip to content

Instantly share code, notes, and snippets.

func getDeviceID(deviceUID: String) -> AudioObjectID? {
var deviceUIDCFString = deviceUID as CFString
var deviceID = kAudioDeviceUnknown
var propertyAddress = AudioObjectPropertyAddress(mSelector: kAudioHardwarePropertyDeviceForUID, mScope: kAudioObjectPropertyScopeGlobal, mElement: kAudioObjectPropertyElementMaster)
let dataSize_CFString = UInt32(MemoryLayout<CFString>.stride)
let dataSize_AudioObjectID = UInt32(MemoryLayout<AudioObjectID>.stride)
// This started giving warnings after upgrading to Swift 5.2
var translation = AudioValueTranslation(
@pdesantis
pdesantis / index.html
Created February 22, 2021 15:59
Display ID Logger
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
<link rel="stylesheet" type="text/css" href="./styles.css">
</head>
<body>
<h1>Hello World!</h1>
<!-- All of the Node.js APIs are available in this renderer process. -->
@pdesantis
pdesantis / index.html
Created September 3, 2019 23:08
Electron Fiddle Gist
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
</head>
<body style="margin: 0">
<div style="height: 50px; width: 100%; background-color: red; cursor: pointer; color: white; text-align: center; font-size: 30px;">
This whole box should have a cursor pointer
</div>
@pdesantis
pdesantis / index.html
Created June 12, 2019 17:41
Electron Fiddle Gist
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
<!-- All of the Node.js APIs are available in this renderer process. -->
We are using Node.js <script>document.write(process.versions.node)</script>,
@pdesantis
pdesantis / index.html
Created June 5, 2019 18:27
Electron Fiddle Gist
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
<!-- All of the Node.js APIs are available in this renderer process. -->
We are using Node.js <script>document.write(process.versions.node)</script>,
@pdesantis
pdesantis / README.md
Last active June 5, 2019 18:26
Electron Fiddle Gist

To use:

  • Load in Electron Fiddle
  • Run
  • Open the Developer console and observe the log messages
@pdesantis
pdesantis / README.md
Last active November 8, 2018 19:38
A simple program to create a GStreamer or GStreamer Editing Services pipeline

GStreamer Editing Services Pipeline debug

Usage:

main <path-to-file> <\"gst\" or \"ges\"> <playback-rate> <start-position-in-seconds>
  • <path-to-file>: The file path to the media file to play.
  • <\"gst\" or \"ges\">: Whether to create just a GStreamer pipeline, or a GStreamer Editing Services pipeline.
  • ``: The playback rate. 1.0 for playback at normal speed.
typealias LoadWebCredentialCompletion = (_ success: Bool, _ account: String?, _ password: String?) -> Void
func loadWebCredentials(completion: @escaping LoadWebCredentialCompletion) {
SecRequestSharedWebCredential(nil, nil) { credentialsArray, error in
guard error == nil else {
return completion(false, nil, nil)
}
let credentials = credentialsArray as? [[String: AnyObject]]
guard let credential = credentials?.first else {
@pdesantis
pdesantis / Fastfile
Created February 11, 2016 22:58
An example Fastfile
# This is the minimum version number required.
# Update this, if you use features of a newer version
fastlane_version "1.41.0"
default_platform :ios
platform :ios do
before_all do
ENV["SLACK_URL"] = "https://hooks.slack.com/services/MoneyWithWings"
@pdesantis
pdesantis / led_pulse.ino
Created June 18, 2013 00:02
Create a "breathing" pulsing effect on an array of LEDs
// Arduino Workshop Project 3
// PWM
int d = 5; // d is used for time delay
const int number_of_pins = 5; // the number of output pins
int pins[number_of_pins] = {3, 5, 6, 9, 10}; // an array storing each output pin
// Sets the proper pins to output mode
void setup()
{