Skip to content

Instantly share code, notes, and snippets.

View hitman99's full-sized avatar

Tomas hitman99

  • Lithuania, Kaunas
View GitHub Profile
@hitman99
hitman99 / pg-cli.yaml
Created July 2, 2021 13:06
Postgresql client pod
apiVersion: v1
kind: Pod
metadata:
name: pgcli
namespace: sandbox
spec:
containers:
- name: pgcli
image: jbergknoff/postgresql-client
command: ['sh', '-c', 'sleep 600']
@hitman99
hitman99 / ci-cd.yaml
Created July 17, 2019 17:54
kubernetes rbac roel and binding for CI integration
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: ci-cd
rules:
- apiGroups:
- apps
- extensions
resources:
- deployments
const outage_avg = ()=>{
const incidents = [...document.querySelectorAll('.incident-list')].map(node => [...node.querySelectorAll('.secondary.color-secondary')]);
let avg = incidents.map(inciList => {
return inciList.reduce( (acc , inci) => {
const timestamps = inci.innerText.substr(0, inci.innerText.length - 4).split('-');
if (timestamps[1].indexOf(',') == -1) {
timestamps[1] = `${timestamps[0].split(',')[0]},${timestamps[1]}`;
}
acc.count++;
acc.average += (new Date(timestamps[1]).getTime() - new Date(timestamps[0]).getTime()) / 60000;
@hitman99
hitman99 / k8s_alias.sh
Last active November 9, 2022 12:54
kubernetes aliases
## Autoexport kubernetes configs
KUBECONFIG=""
for config in $(ls ~/.kube/*.yaml); do
if [[ ! -z $KUBECONFIG ]]; then
KUBECONFIG=$KUBECONFIG:$config
else
KUBECONFIG=$config
fi
done
@hitman99
hitman99 / gpu_stats.sh
Created August 8, 2017 10:35
CloudWatch metrics for GPU on EC2 G3 instance
#!/bin/bash
IFS=', ' read -r -a STATS <<< `nvidia-smi --query-gpu=temperature.gpu,memory.used,memory.free,utilization.gpu,utilization.memory --format=csv,nounits,noheader`
#echo ${STATS[@]}
# Send values to CloudWatch
aws cloudwatch put-metric-data --metric-name Temperature --namespace GPUStats --value ${STATS[0]}
aws cloudwatch put-metric-data --metric-name MemoryUsed --namespace GPUStats --unit Megabytes --value ${STATS[1]}
aws cloudwatch put-metric-data --metric-name MemoryFree --namespace GPUStats --unit Megabytes --value ${STATS[2]}
aws cloudwatch put-metric-data --metric-name GPUUtilization --namespace GPUStats --value ${STATS[3]}