Skip to content

Instantly share code, notes, and snippets.

View tchen's full-sized avatar
:shipit:

Tom Chen tchen

:shipit:
  • Dallas, TX
View GitHub Profile
@tchen
tchen / sample.go
Last active July 22, 2022 08:30
aws-sdk-go-v2 credentials
// How to set up a AWS SDK client using credentials coming from other than the regular AWS_ACCESS_KEY_ID
// e.g. if you have multiple sets of credentials for doing cross-account stuff
import (
"os"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/service/s3"
)
@tchen
tchen / gist:a844c589f3fab497ff930c116aa267e7
Last active January 8, 2024 07:30
Extract Images From Zillow Home Views
/**
* Note: First, browser through all the images for the home. Then paste the following snippet into the console.
* Images will be saved to the download directory.
*/
var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
// ... give time for script to load, then type.
@tchen
tchen / observe.py
Created November 27, 2020 06:34
Observe Bluetooth advertisements for Govee H5075 and H5177 thermo-gygrometer and print out temperature, humidity, battery level
import datetime
from time import sleep
from bleson import get_provider, Observer
def c2f(val):
return round(32 + 9*val/5, 2)
last = {}
def temp_hum(values, battery, address):
@tchen
tchen / sample.py
Last active April 8, 2024 01:38
openpyxl: dealing with merged cells
# When exporting excel spreadsheets with merged cells, only the first cell of the merged cell has a value
# This snippet allow you to take the value from the first cell for all the other cells within the merged range
# Tested with openpyxl 3.0.7 as of 2021-06-17
#
# References:
# https://stackoverflow.com/questions/39574991/how-to-detect-merged-cells-in-excel-with-openpyxl
# https://openpyxl.readthedocs.io/en/stable/api/openpyxl.worksheet.merge.html
import openpyxl
def parent_of_merged_cell(cell):