Skip to content

Instantly share code, notes, and snippets.

// Copyright 2007, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
@seahrh
seahrh / get_aws_token.sh
Created March 4, 2021 02:54
AWS session token
aws sts get-session-token --duration-seconds 36000
[pytest]
filterwarnings =
ignore::DeprecationWarning:tensorflow.*
markers =
slow: marks tests as slow (deselect with '-m "not slow"')
@seahrh
seahrh / s3copy.sh
Created March 31, 2021 01:38
aws s3 copy wildcard matching
aws s3 cp s3://mybucket/models/ models/ --recursive --exclude "*" --include "*effnetb3-20210330-150641*"
@seahrh
seahrh / create_training_job.json
Created April 6, 2021 07:05
Create training job on sagemaker
{
"TrainingJobName": "",
"HyperParameters": {
"epochs": "40",
"folds": "5",
"patience": "4",
"batch_size": "32",
"input_shape": "300,300,3",
"pooling": "avg",
"hidden_layer_sizes": "100",
@seahrh
seahrh / .zshrc
Last active January 4, 2022 10:42
zsh config: place $ZSH_CUSTOM/zsh-autosuggestions_custom.zsh
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
@seahrh
seahrh / config
Created May 6, 2021 03:04 — forked from pksunkara/config
Sample of git config file (Example .gitconfig) (Place them in $XDG_CONFIG_HOME/git)
[user]
name = Pavan Kumar Sunkara
email = [email protected]
username = pksunkara
[core]
editor = vim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
pager = delta
[sendemail]
smtpencryption = tls
@seahrh
seahrh / pandas.py
Created May 12, 2021 01:38
Pandas config
pd.set_option("use_inf_as_na", True)
pd.set_option("max_info_columns", 9999)
pd.set_option("display.max_columns", 9999)
pd.set_option("display.max_rows", 9999)
pd.set_option('max_colwidth', 9999)
@seahrh
seahrh / timestamp_dir.py
Created May 12, 2021 01:40
Make timestamped directory
import pathlib
from datetime import datetime
ts = datetime.now().strftime('%Y%m%d_%H%M%S')
job_dir = f"models/mlp/{ts}"
pathlib.Path(job_dir).mkdir(parents=True, exist_ok=True)
@seahrh
seahrh / pandas_drop_empty_string
Created June 1, 2021 07:28
Pandas drop rows that have empty string
%%time
len1 = len(train)
train["col"] = train["col"].str.strip()
train.drop(train[train["col"].str.len() == 0].index, inplace=True)
len2 = len(train)
print(f"{len1 - len2} rows deleted")