Skip to content

Instantly share code, notes, and snippets.

View bigsan's full-sized avatar

San Chen bigsan

  • LearningTech
  • Taiwan
View GitHub Profile
@bigsan
bigsan / SignInWithAppleFirebaseButton.swift
Created March 29, 2023 07:11 — forked from henrik-dmg/SignInWithAppleFirebaseButton.swift
A SwiftUI wrapper around the new Sign in with Apple button that returns OAuthCredentials directly to login with Firebase
import AuthenticationServices
import CryptoKit
import FirebaseAuth
import Foundation
import SwiftUI
// Adapted from https://firebase.google.com/docs/auth/ios/apple?authuser=0
@available(iOS 14.0, OSX 10.16, tvOS 14.0, *)
@available(watchOS, unavailable)
@bigsan
bigsan / .editorconfig
Created January 5, 2023 06:23 — forked from rodrigoueda/.editorconfig
Editor Config C#
# Remove the line below if you want to inherit .editorconfig settings from higher directories
root = true
# C# files
[*.cs]
#### Core EditorConfig Options ####
# Severities
dotnet_diagnostic.IDE0016.severity = none
@bigsan
bigsan / dockerfile_from_hist.sh
Created December 6, 2020 04:39
Dockerfile from image history
# https://stackoverflow.com/questions/19104847/how-to-generate-a-dockerfile-from-an-image/50926503#50926503
docker history --no-trunc $argv | tac | tr -s ' ' | cut -d " " -f 5- | sed 's,^/bin/sh -c #(nop) ,,g' | sed 's,^/bin/sh -c,RUN,g' | sed 's, && ,\n & ,g' | sed 's,\s*[0-9]*[\.]*[0-9]*\s*[kMG]*B\s*$,,g' | head -n -1
@bigsan
bigsan / ftx_lending_hist_apy.js
Created December 5, 2020 08:04
Show APY of lending history on FTX
// ==UserScript==
// @name Show APY of lending history on FTX
// @namespace https://gist.github.com/bigsan/
// @version 0.1
// @description Show APY of lending history on FTX
// @author You
// @match https://ftx.com/spot-margin/lending
// @grant none
// ==/UserScript==

Tesla Key Card Protocol

Researched by Robert Quattlebaum darco@deepdarc.com.

Last updated 2020-02-03.

Image of Tesla Key Card Image of Tesla Model 3 Key Fob

@bigsan
bigsan / awk_netstat.sh
Created December 4, 2019 03:52 — forked from staaldraad/awk_netstat.sh
AWK to get details from /proc/net/tcp and /proc/net/udp when netstat and lsof are not available
# Gawk version
# Remote
grep -v "rem_address" /proc/net/tcp | awk '{x=strtonum("0x"substr($3,index($3,":")-2,2)); for (i=5; i>0; i-=2) x = x"."strtonum("0x"substr($3,i,2))}{print x":"strtonum("0x"substr($3,index($3,":")+1,4))}'
# Local
grep -v "rem_address" /proc/net/tcp | awk '{x=strtonum("0x"substr($2,index($2,":")-2,2)); for (i=5; i>0; i-=2) x = x"."strtonum("0x"substr($2,i,2))}{print x":"strtonum("0x"substr($2,index($2,":")+1,4))}'
# No Gawk
# Local
grep -v "rem_address" /proc/net/tcp | awk 'function hextodec(str,ret,n,i,k,c){
//--------------------------------------------------
// The SwiftUI Lab: Advanced SwiftUI Animations
// https://swiftui-lab.com/swiftui-animations-part1
//--------------------------------------------------
import SwiftUI
struct ContentView: View {
var body: some View {
NavigationView {
//
// FacebookReactions.swift
//
// Created by Fabio Giolito on 10/06/2019.
// Follow me: https://twitter.com/fabiogiolito
//
import SwiftUI
struct FacebookReactions : View {
@bigsan
bigsan / hw_measure.sh
Created May 30, 2019 05:42
[Get hardware status of Raspberry Pi] Use vcgencmd to gather information of a running Raspberry Pi #raspi
#!/bin/bash
#
# https://elinux.org/RPI_vcgencmd_usage
# https://blog.gtwang.org/iot/raspberry-pi-vcgencmd-hardware-information/
#
# list avaiable commands
# vcgencmd commands
#
@bigsan
bigsan / install_go_pi.sh
Last active January 7, 2021 16:10 — forked from pcgeek86/install_go_pi.sh
Install Go Lang 1.12.5 on Raspberry Pi 3 B+
cd $HOME
FileName='go1.12.5.linux-armv6l.tar.gz'
wget https://dl.google.com/go/$FileName
sudo tar -C /usr/local -xvf $FileName
cat >> ~/.bashrc << 'EOF'
export GOPATH=$HOME/go
export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin
EOF
source ~/.bashrc