Skip to content

Instantly share code, notes, and snippets.


Stanley Zheng stanzheng

View GitHub Profile
stanzheng / filter.ps1
Created Jun 21, 2021
powershell spreadsheets
View filter.ps1
Import-CSV -Path .\pluto_21v1.csv |Where-Object {$_.borough -eq "BK" -and $_.zipcode -in @(11205, 11206, "11216", 11221, 11233, 11238) -and $_.bldgclass -like "V*"} | Export-Csv -Path .\vacant_bedstuy_brooklyn_pluto_21v1.csv
Import-CSV -Path .\pluto_21v1.csv |Where-Object {$_.borough -eq "BK" -and $_.zipcode -in @(11205, 11206, 11216, 11221, 11233, 11238) -and $_.bldgclass -like "V*"} | select -ExpandProperty zipcode
select -ExpandProperty bldgclass
Import-CSV -Path .\pluto_21v1.csv |Where-Object {$_.borough -eq "BK" -and $_.zipcode -in @(11205, 11206, "11216", 11221, 11233, 11238) -and $_.bldgclass -like "V*"} | select
Import-CSV -Path .\pluto_21v1.csv |Where-Object {$_.borough -eq "BK" -and $_.zipcode -match "11216" -and $_.bldgclass -like "V"} | Export-Csv -Path .\Processes.csv
stanzheng / ssh rule
Last active Jun 5, 2020
Generate SSH IP Allow-list
View ssh rule
set -- $(dig -t txt +short +trace)
included="" ip4=""
while [ $# -gt 0 ]; do
k="${1%%:*}" v="${1#*:}"
case "$k" in
# only include once
stanzheng / main.c
Created May 13, 2020 — forked from ColorfulCodes/main.c
This is the mt3620 blinky
View main.c
#include <stdbool.h>
#include <errno.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <applibs/storage.h>
#include <applibs/log.h>
#include <applibs/gpio.h>
stanzheng /
Created Nov 5, 2019
Mastermind in Python!
## Mastermind
## Two Players
## 6 colors
## First Guess
TRYS = 10
MASTERMIND_CODE = ['r', 'g', 'r', 'b']
import getpass
View aggregations.sql
SELECT owner,
Count(DISTINCT( breed )) AS num_breeds,
Count(name) AS num_dogs
FROM dogs
GROUP BY owner
ORDER BY num_dogs DESC
stanzheng / cloudSettings
Last active May 25, 2020
Visual Studio Code Settings Sync Gist
View cloudSettings
stanzheng / _0000trackpad
Last active Oct 9, 2019
X1 Carbon 7 linux setup
View _0000trackpad
case "$1" in
DISPLAY=:0.0 su USER -c '/usr/bin/synclient TouchpadOff=0' ;;
# /etc/pm/sleep.d/0000trackpad
stanzheng / aws.txt
Last active Jul 16, 2019
Useful Cloud Commands
View aws.txt
# Authenticate ECR
eval $(aws ecr get-login --no-include-email | sed 's|https://||')
export AWS_PROFILE=aws-sand; eval $(aws ecr get-login --no-include-email --region us-east-1 --profile aws-sand | sed 's|https://||')
docker tag foobar:latest
# for each buckets
export BUCKET_PREFIX="s3://nfl-sandbox-datalake-"
array=( aws s3 ls $BUCKET_PREFIX* )
for i in "${array[@]}"
View gist:cecac459cceb20492499ba71150bd874
import unittest
def is_binary_search_tree(root):
# Determine if the tree is a valid binary search tree
stack = [(root, -float('inf'), float('inf'))]
while len(stack):
node, lower_bound, upper_bound = stack.pop()
if (node.value <= lower_bound) or (node.value >= upper_bound):
return False
import np
## get all input
claims = [[int(sub_str) for sub_str in re.findall(r'-?\d+', line)] for line in inputz.split('\n')]
## populate an array
canvas = np.zeros((1000,1000))