Skip to content

Instantly share code, notes, and snippets.

View stevenvo's full-sized avatar

Steven Vo stevenvo

  • GeoComply
  • Bay Area
View GitHub Profile
@stevenvo
stevenvo / numpy-array-sort.py
Last active March 16, 2021 08:23
Sort array by nth column in Numpy
# sort array with regards to nth column
arr = arr[arr[:,n].argsort()]
@stevenvo
stevenvo / struct.go
Last active July 27, 2020 00:32
Struct #go #struct
// Definition
type identifier struct {
field1 type1
field2 type2
...
}
// Example struct defintion for use below
type struct1 struct { // struct definition
i1 int
@stevenvo
stevenvo / useful_pandas_snippets.py
Last active February 13, 2020 18:45 — forked from bsweger/useful_pandas_snippets.md
Useful Pandas Snippets
###### FORCE DATA FORMAT IN PANDAS ######
pd.options.display.float_format = '{:,.2f}'.format
# NOTES:
# 1. DO NOT update row in df.iterrows() -> https://stackoverflow.com/questions/25478528/updating-value-in-iterrow-for-pandas
# Use df.loc[idx, '<col>'] = <value>
###### REGEX on DataFrame ######
@stevenvo
stevenvo / s3_cp.sh
Created June 19, 2019 01:11
Download file from S3 - Recursive, include/exclude patterns
aws s3 cp s3://<bucket_name> <local_folder>/ --recursive --exclude "*" --include "*201906*json" --include "*201906*pColdStart*" --exclude "*baseline*" --exclude "*candidate*"
@stevenvo
stevenvo / jasonette.json
Last active May 31, 2019 22:32
jasonette.json
{
"$jason": {
"head": {
"title": "{ ˃̵̑ᴥ˂̵̑}",
"actions": {
"$foreground": {
"type": "$reload"
}
}
},
@stevenvo
stevenvo / sql.sql
Last active January 29, 2018 23:13
Database Useful SQLs
-- Redshift - Query usage --
select
sum(capacity)/1024 as capacity_gbytes,
sum(used)/1024 as used_gbytes,
(sum(capacity) - sum(used))/1024 as free_gbytes
from
stv_partitions where part_begin=0;
-- usage by tables --
@stevenvo
stevenvo / git.cmd
Last active January 28, 2018 21:30
Useful Git Command
# Pulling a git repository as a git module into your project
# "master" is the branch of the remote repository to use
git submodule add -b master https://github.com/Komodo/trackchanges.git src/modules/trackchanges
# get status recursively
git submodule status --recursive
# Iterate through all git submodule to add and comment and commit
@stevenvo
stevenvo / useful_python_snippets.py
Last active January 13, 2018 21:56
Useful python snippets
#############################################################################
# Generate Dict from a List of Dict
ticker = [
{
'symbol': 'ABC',
'price': 100.0
},
{
'symbol': 'CDE',
'price': 105.0
@stevenvo
stevenvo / .gitignore
Created October 24, 2017 22:53
Python .gitignore
*.DS_Store
*.pyc
@stevenvo
stevenvo / xz.sh
Last active October 22, 2017 07:54
uncompress xz file
$ brew install xz
$ xz -d to-extract.xz