Skip to content

Instantly share code, notes, and snippets.

View harrisonrw's full-sized avatar

Robert Harrison harrisonrw

View GitHub Profile
@harrisonrw
harrisonrw / IDETemplateMacros.plist
Created December 2, 2024 19:56
Custom Xcode File Header
<?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">
<dict>
<key>FILEHEADER</key>
<string>
// ___FILENAME___
// ___PROJECTNAME___
//
// Copyright © 2024 RWH Technology, LLC. All rights reserved.
@harrisonrw
harrisonrw / clone_voice.py
Created November 17, 2024 22:59
Voice Cloning using Tortoise-TTS on Apple Silicon
# See detailed instructions here:
# https://robertharrison.ca/blog/voice-cloning-tortoise-tts-apple-silicon/
# Import PyTorch and Tortoise.
import torch
import torchaudio
import torch.nn as nn
import torch.nn.functional as F
from tortoise.api import TextToSpeech
from tortoise.utils.audio import load_audio, load_voice, load_voices
@harrisonrw
harrisonrw / ReadFromBigQueryViaFirebaseFunction.js
Created January 26, 2022 22:17
Read from BigQuery via Firebase Function
const functions = require("firebase-functions");
const {BigQuery} = require('@google-cloud/bigquery');
exports.getMostPolluted = functions.https.onCall((data, context) => {
const bigQuery = new BigQuery();
const query = 'SELECT location, city, country, value, timestamp FROM `bigquery-public-data.openaq.global_air_quality` WHERE pollutant = "pm25" AND timestamp > "2020-01-01" ORDER BY value DESC LIMIT 10';
return bigQuery.query(query)
@harrisonrw
harrisonrw / UIView+RoundedCorners.swift
Created July 23, 2019 03:12
Swift extension on UIView to round the corners
// UIView+RoundedCorners.swift
//
// Created by Robert Harrison on 7/22/19.
// Copyright © 2019 Robert Harrison. All rights reserved.
//
// Usage:
// view.roundCorners([.topLeft, .topRight], cornerRadius: 8.0)
import UIKit