Skip to content

Instantly share code, notes, and snippets.

@joepol
joepol / aws-sigv4-ssm-get-parameter.sh
Created March 22, 2023 10:09 — forked from slawekzachcial/aws-sigv4-ssm-get-parameter.sh
Using CURL to call AWS ReST API, signing request with v4 signature
#!/bin/bash
# Source: https://docs.aws.amazon.com/general/latest/gr/sigv4-signed-request-examples.html
[[ -n "${AWS_ACCESS_KEY_ID}" ]] || { echo "AWS_ACCESS_KEY_ID required" >&2; exit 1; }
[[ -n "${AWS_SECRET_ACCESS_KEY}" ]] || { echo "AWS_SECRET_ACCESS_KEY required" >&2; exit 1; }
readonly parameterName="SlawekTestParam"
readonly method="POST"
@joepol
joepol / Examine_Before_Commit.md
Last active June 13, 2022 15:55
Things to examine before committing a new feature :

Things to examine before committing a new feature :

  1. OS
    • what will happen in Linux/Win/AIX/POWERPC? (vice versa)
    • Is agent / db on other OSs acts the same? (process per connection, …)
    • Do common parts of the code use os agnostic code ? (types.h, no OS specific API, …)
    • Environments
      • K8S
      • BigData
  2. Memory
@joepol
joepol / sources.list
Last active June 20, 2022 07:18 — forked from rohitrawat/sources.list
Ubuntu 16.04 Xenial default /etc/apt/sources.list
#deb cdrom:[Ubuntu 16.04.2 LTS _Xenial Xerus_ - Release amd64 (20170215.2)]/ xenial main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://us.archive.ubuntu.com/ubuntu/ xenial main restricted
# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
@joepol
joepol / RunAllAndRedirect.sh
Last active August 9, 2020 15:26
Bash script to run all files in a directory redirect output to text file
#!/bin/bash
echo "Run all files in dir, redirect outputs to text files"
echo " "
for file in DIRECTORY/*
do
filename=`basename $file`
echo "Currently runing $filename"
"$file" >> output_$filename.txt
@joepol
joepol / cppMatlabMod
Last active March 4, 2020 17:08
C++ floating point modulo that behaves like Matlab's mod function
inline double matlabMod(double q, double m)
{
if(m == 0)
return q;
double result = fmod(q, m);
return ((result >= 0 && m > 0) || (q <= 0 && m < 0)) ? result : (result + m);
}
/**
@joepol
joepol / degrees-radians.h
Last active February 27, 2020 07:37 — forked from dbrockman/degrees-radians.h
Convert degrees <-> radians [C++]
#include<math.h>
const double DEG_TO_RAD = (M_PI / 180.0);
const double RAD_TO_DEG = (180.0 / M_PI);
inline double DegreesToRadians(double angleDegrees){
return angleDegrees * DEG_TO_RAD;
}
inline double RadiansToDegrees(double angleRadians){
@joepol
joepol / print_installed_packages
Created October 20, 2019 05:47
Python installed packages
import pip
installed_packages = pip.get_installed_distributions()
installed_packages_list = sorted(["%s==%s" % (i.key, i.version)
for i in installed_packages])
print(installed_packages_list)
@joepol
joepol / Linux_Cheat_Sheet.md
Last active November 27, 2022 11:35
useful Linux (Ubuntu) shell commands

Redirection of both out and err channels to a file ,

(redirects stdout to a file and redirects stderr to "where" stdout is redirected)

./SCRIPT_NAME > out.txt 2>&1 

Get live update of a file (in terminal)

tail -f your.log

Get full process path