Skip to content

Instantly share code, notes, and snippets.

export function fromObject<T extends jspb.Message, U>(c: new () => T, obj: U): T {
const instance = new c();
Object.keys(obj)
.forEach(key => {
const setterName = makeSetterFuncName(key);
(instance as any)[setterName] = (obj as any)[key];
});
return instance;
}
import * as React from 'react';
import * as GoogleWebAuth from 'expo-auth-session/providers/google';
import * as GoogleAppAuth from "expo-google-app-auth";
import * as WebBrowser from 'expo-web-browser';
import * as AppAuth from 'expo-app-auth';
import { Platform } from 'react-native';
import Constants, {AppOwnership} from 'expo-constants';
// Call this function once in your Component which handles the Google authentication
// flow; typically done outside of the component decleration (ie: just after your
@jonnyreeves
jonnyreeves / shutdown_after_replication.sh
Created November 23, 2025 09:56
TrueNAS Scale scripts to (a) handle waking a backup server from sleep, (b) shut down the backup server after a grace period has passed AND all replication / scrub activity is complete. `Install wake_backup_server_for_replication.sh` as a cron job on the main server, triggered once 30m before your replication task is scheduled. Install `shutdown_…
#!/bin/bash
# -----------------------------------------------
# shutdown_after_replication.sh – Overview
#
# This script safely powers off the server when nightly ZFS replication
# has completed (or has not begun within a configured time window).
# Intended to be run via cron after a remote server wakes for replication.
#
# Workflow: