Skip to content

Instantly share code, notes, and snippets.

Avatar

Sean Li seanli1

  • 86 Houses, LLC
  • New York, NY
View GitHub Profile
@seanli1
seanli1 / Coinmarketcap API
Last active Mar 13, 2021 — forked from erajanraja24/Coinmarketcap API
Configure Coinmarketcap API on Google sheets
View Coinmarketcap API
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 Feb 6, 2021
Like a dashcam but with a microphone. See other gist for source reference
View dashmic.py
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 Jan 23, 2021
Back up raspberry pi home directory to Google Drive via scp to another computer
View scp_backup.sh
#!/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 Jan 23, 2021
Sends the device name IP address to IFTTT webhook
View send_ip.sh
#!/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 Jan 20, 2021
IFTTT Webhook QR Maker - generate a QR code that corresponds with a webhook made in IFTTT
View qrhook.py
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
Clean DoublePicker I made since SwiftUI only offers a single Picker.
View DoublePicker.swift
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 Mar 21, 2021
Import/Export JSON in Google Sheets - original: https://gist.github.com/pamelafox/1878143
View JSONImporterExporter.gs
// 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
Changelog script for Google Sheets (see warning)
View Changelog.gs
// 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
Add json file to your Project Navigator, and run this to upload it to Firebase easily using a demo app. Call `FirebaseHelper.uploadJsonFileToFirebase()`.
View FirebaseHelper.swift
//
// 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
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.
View AppDelegate.swift
//
// AppDelegate.swift
//
//
// Created by Sean Li on 5/22/19.
// Copyright © 2019 Sean Li. All rights reserved.
//
import UIKit
import Firebase