Skip to content

Instantly share code, notes, and snippets.

@kodelint
kodelint / git-update-submodules.sh
Created October 28, 2016 20:41
Pull latest update for git submodules
#!/bin/bash
APP_PATH=$1
shift
if [ -z $APP_PATH ]; then
echo "Missing 1st argument: should be path to folder of a git repo";
exit 1;
fi
@kodelint
kodelint / auto_activate_virtualenv.sh
Last active December 8, 2016 22:15
Auto activate virtualenv
auto_activate_virtualenv() {
current_dir="${PWD##*/}"
if [ -e ~/.virtualenvs/$current_dir ]; then
deactivate >/dev/null 2>&1
source ~/.virtualenvs/$current_dir/bin/activate
else
deactivate >/dev/null 2>&1
fi
}
@kodelint
kodelint / caniusepython3
Created January 4, 2017 19:22
Not sure if the library has python3 support. Try caniusepython3 https://github.com/brettcannon/caniusepython3
caniusepython3 -r requirements.txt test-requirement.txt
caniusepython3 -m PKG-INFO
caniusepython3 -p numpy scipy ipython
# If your project's setup.py uses setuptools
# (note that setup_requires can't be checked) ...
python setup.py caniusepython3
@kodelint
kodelint / find_exe.py
Created January 5, 2017 18:40
nix like which function for python
def which(program):
"""
:param program: i.e. docker, python etc
:return: full path for the given binary
"""
import os
def is_exe(fpath):
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
@kodelint
kodelint / keymapping.fish
Created January 23, 2017 18:12
Fish Dir path toggle function
function fish_user_key_bindings
bind ' ' __toggle_dir_length # toggle PWD on NORMAL mode
end
@kodelint
kodelint / golang-struct-memory-allocation-optimized.go
Last active April 16, 2022 16:52
Golang Struct Memory Allocation Verifier
package main
import "fmt"
import "unsafe"
type TerraformResource struct {
Cloud string // 16 bytes
Name string // 16 bytes
PluginVersion string // 16 bytes
TerraformVersion string // 16 bytes
@kodelint
kodelint / golang-struct-memory-allocation.go
Last active April 16, 2022 16:52
Golang Memory Allocation Verifier
package main
import "fmt"
import "unsafe"
type TerraformResource struct {
Cloud string // 16 bytes
Name string // 16 bytes
HaveDSL bool // 1 byte
PluginVersion string // 16 bytes
@kodelint
kodelint / output.txt
Last active March 29, 2022 00:53
Autotf Verify Output
INFO 2022-03-28 17:50:29 will run terraform init, plan on [autotf-testing01.tfvars]
+------------------+----------------+-------------------------+-----------------------------------+
| Resource Name | Backend Bucket | TFVars Name | Backend Key |
+------------------+----------------+-------------------------+-----------------------------------+
| autotf-testing01 | autotf-testing | autotf-testing01.tfvars | stage/s3/autotf-testing01.tfstate |
+------------------+----------------+-------------------------+-----------------------------------+
Initializing the backend...
@kodelint
kodelint / output.txt
Created March 29, 2022 01:08
Autotf Deploy Step
INFO 2022-03-28 18:07:27 will run terraform init, plan and apply on [autotf-testing01.tfvars]
+------------------+----------------+-------------------------+-----------------------------------+
| Resource Name | Backend Bucket | TFVars Name | Backend Key |
+------------------+----------------+-------------------------+-----------------------------------+
| autotf-testing01 | autotf-testing | autotf-testing01.tfvars | stage/s3/autotf-testing01.tfstate |
+------------------+----------------+-------------------------+-----------------------------------+
@kodelint
kodelint / output.tf
Created March 29, 2022 01:13
Autotf Resource Destroy
INFO 2022-03-28 18:13:07 will run terraform init, plan -destory on [autotf-testing01.destroy]
Initializing the backend...
Initializing provider plugins...
- Reusing previous version of hashicorp/aws from the dependency lock file
- Using previously-installed hashicorp/aws v4.8.0
Terraform has been successfully initialized!