Skip to content

Instantly share code, notes, and snippets.

View imWildCat's full-sized avatar

Mike Chong imWildCat

  • Canada
View GitHub Profile
@imWildCat
imWildCat / QuickXorHash.rs
Created May 18, 2022 02:50 — forked from gzxu/QuickXorHash.rs
Implementing the QuickXorHash Algorithm used by the Microsoft Graph API on OneDrive for Business
use std::env;
use std::fs;
// extern crate base64;
// From the specification
// https://docs.microsoft.com/en-us/onedrive/developer/code-snippets/quickxorhash
// According to the spec, the block is "big-endian"
type Block = [u8; 20]; // Intrinsically with Copy trait
@imWildCat
imWildCat / cross-compile.md
Created March 23, 2022 01:58
Rust: Cross-compile on macOS for Linux
@imWildCat
imWildCat / extensions.json
Last active March 14, 2022 13:30
VSCode for iOS Development with Swift
{
"recommendations": [
"vknabel.vscode-apple-swift-format",
"sswg.swift-lang",
"nisargjhaveri.ios-debug"
]
}
@imWildCat
imWildCat / Fastfile.rb
Created August 25, 2021 12:35
Fastfile
# frozen_string_literal: true
# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
# https://docs.fastlane.tools/actions
#
# For a list of all available plugins, check out
@imWildCat
imWildCat / misc.md
Created July 23, 2021 08:16
M1 Mac Misc

Install the pg gem on M1:

arch -arch x86_64 gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/13/bin/pg_config
config openvpn 'myvpn'
option dev 'tun'
option topology 'subnet' # This is important
option comp_lzo 'adaptive'
option ca '/etc/openvpn/ca.crt'
option dh '/etc/openvpn/dh.pem'
option cert '/etc/openvpn/server.crt'
option key '/etc/openvpn/server.key'
option persist_key '1'
option persist_tun '1'
@imWildCat
imWildCat / cloudkit.d.ts
Last active May 8, 2021 02:46
Better typing for Apple CloudKit.js
/*! *!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*\
Apple CloudKit TypeScript Library
Copyright (c) TypeScriptLibs and Contributors
Licensed under the MIT License; you may not use this file except in
compliance with the License. You may obtain a copy of the MIT License at
https://typescriptlibs.org/LICENSE.txt
@imWildCat
imWildCat / 1gb_swap.sh
Created February 16, 2021 13:32
Enable 1GB Swap
# Credit: https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-16-04
echo "Your current swap is:"
sudo swapon --show
free -h
echo "Your disk usage is:"
df -h
echo "Press any key to continue..."
read -s -n 1 key
echo "Allocating 1GB swap file:"
@imWildCat
imWildCat / ItemDeleteConfirmationActor.swift
Created February 7, 2021 13:00
SwiftUI: Generic delete confirmation
extension ItemDeleteConfirmationActor {
func onDelete(_ indexSet: IndexSet) {
_alertStatus.wrappedValue = .deleteConfirmation(indexSet: indexSet)
}
func deleteConfirmationAlert() -> some View {
alert(item: _alertStatus) { alertStatus -> Alert in
switch alertStatus {
case let .deleteConfirmation(indexSet):
return Alert(
@imWildCat
imWildCat / remove.sh
Created December 20, 2020 01:14
Remove Google Chrome: Keystone
rm ~/Library/LaunchAgents/com.google.keystone.agent.plist
rm ~/Library/LaunchAgents/com.google.keystone.xpcservice.plist
rm ~/Library/Caches/com.google.Keystone
rm ~/Library/Preferences/com.google.Keystone.Agent.plist