Skip to content

Instantly share code, notes, and snippets.

View seanli1's full-sized avatar

Sean Li seanli1

  • 86 Houses, LLC
  • New York, NY
View GitHub Profile
@seanli1
seanli1 / Coinmarketcap API
Last active March 13, 2021 21:15 — forked from erajanraja24/Coinmarketcap API
Configure Coinmarketcap API on Google sheets
function crypto(coinSymbol) {
var apiKey = "YOUR-API-KEY-HERE";
var url = "https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest?symbol=" + coinSymbol
var requestOptions = {
method: 'GET',
uri: 'https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest',
qs: {
start: 1,
limit: 5000,
convert: 'USD'
@seanli1
seanli1 / dashmic.py
Created February 6, 2021 06:53
Like a dashcam but with a microphone. See other gist for source reference
import pyaudio
import wave
import datetime
# Settings
output_dir = 'path/to/destination'
record_secs = 600 # seconds to record
dev_index = 2 # device index found by p.get_device_info_by_index(ii)
@seanli1
seanli1 / scp_backup.sh
Last active January 23, 2021 22:36
Back up raspberry pi home directory to Google Drive via scp to another computer
#!/bin/bash
# Send a zip backup of the /home directory via scp
# to Google Drive via Sean's computer & SSH. (Need port forwarding if accessing from external network)
# The target folder name in Google Drive. Setting to something static
# instead of something like $HOSTNAME in case that ever changes.
device_name=screenpi
# Name of the file
@seanli1
seanli1 / send_ip.sh
Last active January 23, 2021 01:06
Sends the device name IP address to IFTTT webhook
#!/bin/bash
# This app sends the device name IP address to IFTTT webhook
# Run this regularly by adding to the chronos table. In Terminal:
# `crontab - e`
# Add to list. I.e. if you want to run monthly:
# `@monthly bash send_ip.sh`
# device_name=new_device
@seanli1
seanli1 / qrhook.py
Last active January 20, 2021 19:44
IFTTT Webhook QR Maker - generate a QR code that corresponds with a webhook made in IFTTT
import requests
# Account Information
# Webhook keys for each IFTTT account
key1 = 'xxxx'
key2 = 'xxxx'
allKeys = [key1, key2]
noOfAccounts = len(allKeys)
@seanli1
seanli1 / DoublePicker.swift
Last active May 10, 2020 18:16
Clean DoublePicker I made since SwiftUI only offers a single Picker.
import SwiftUI
struct DoublePicker: UIViewRepresentable {
let leftOptions: [Any]
@Binding var leftSelection: Int
let rightOptions: [Any]
@Binding var rightSelection: Int
@seanli1
seanli1 / JSONImporterExporter.gs
Last active August 9, 2021 20:42
Import/Export JSON in Google Sheets - original: https://gist.github.com/pamelafox/1878143
// IMPORT
/**
* Imports JSON data to your spreadsheet Ex: IMPORTJSON("http://myapisite.com","city/population")
* @param url URL of your JSON data as string
* @param xpath simplified xpath as string
* @customfunction
*/
function IMPORTJSON(url,xpath){
@seanli1
seanli1 / Changelog.gs
Last active May 25, 2019 23:28
Changelog script for Google Sheets (see warning)
// WARNING: This will cause issues with the Undo function.
function onEdit(e) {
// Set sheet name (it must already exist):
var sheetName = "Changelog"
// e contains:
// - authorized mode
// - range
// - source
// - user
@seanli1
seanli1 / FirebaseHelper.swift
Last active May 23, 2019 03:32
Add json file to your Project Navigator, and run this to upload it to Firebase easily using a demo app. Call `FirebaseHelper.uploadJsonFileToFirebase()`.
//
// FirebaseHelper.swift
//
//
// Created by Sean Li on 5/22/19.
// Copyright © 2019 Sean Li. All rights reserved.
//
import Foundation
import Firebase
@seanli1
seanli1 / AppDelegate.swift
Last active May 23, 2019 03:22
AppDelegate.swift starter code with Firebase initialization that minimizes print statements and sets up remote notifications with perks: notify when app is in foreground, and clear badge on open.
//
// AppDelegate.swift
//
//
// Created by Sean Li on 5/22/19.
// Copyright © 2019 Sean Li. All rights reserved.
//
import UIKit
import Firebase