Skip to content

Instantly share code, notes, and snippets.

diff --git a/nxkeygen b/nxkeygen
index 1a2ac8c..9a8b993 100755
--- a/nxkeygen
+++ b/nxkeygen
@@ -27,7 +27,7 @@ main ()
{
# create a new key
umask 177
- $COMMAND_SSH_KEYGEN -q -t dsa -N '' -f ${NX_KEY_DIR}/local.id_dsa
+ $COMMAND_SSH_KEYGEN -q -b 2048 -t rsa -N '' -f ${NX_KEY_DIR}/local.id_dsa
@DylanGraham
DylanGraham / check_reservation.py
Last active February 29, 2016 03:24
Script to check system reservations before extending job
#!/usr/bin/python2
import sys
def get_hours(time):
t = time.split(':')
return int(t[0]) * 24 + int(t[1])
@DylanGraham
DylanGraham / extend_job
Last active February 29, 2016 03:25
Script to safely extend PBS job walltime. Use with check_reservation.py
#!/bin/bash
# extend_job
#
# extend the life of a PBS job
#
# Written by Brett Pemberton, brett@vpac.org
# Copyright (C) 2008 Victorian Partnership for Advanced Computing
# This program is free software: you can redistribute it and/or modify
#!/bin/bash
fail() {
echo "Failed: $1"
exit 1
}
NODES=$(ssh mgt "diagnose -n | egrep '^comp[0-1][0-9][0-9].*Idle' | awk {'print \$1'}")
WORDS=$(echo ${NODES} | wc -w)
let "NUM_OF_NODES = $WORDS - 1"
------------------------------------------------------------
___
____ _ _____ _.-| | |\__/,| (`\
__ __/ ___| / \|_ _| { | | |x x |__ _) )
\ \/ / | / _ \ | | "-.|___| _.( T ) ` /
> <| |___ / ___ \| | .--'-`-. _((_ `^--' /_< \
/_/\_\\____/_/ \_\_| .+|______|__.-||__)`-'(((/ (((/
------------------------------------------------------------

Keybase proof

I hereby claim:

  • I am DylanGraham on github.
  • I am dylangraham (https://keybase.io/dylangraham) on keybase.
  • I have a public key whose fingerprint is D6B9 E84A 7190 81A2 E172 2E68 274A 2722 8178 28DA

To claim this, I am signing this object:

@DylanGraham
DylanGraham / rmOldKernels.sh
Last active January 25, 2017 04:50
Remove your old kernels on Fedora
#!/bin/bash
UNAME=$(uname -r)
CUR=($(echo "$UNAME" | awk -F'[.-]' '{print $1 $2 $3 $4}'))
CUR_1=($(echo "$UNAME" | awk -F'[.-]' '{print $1}'))
CUR_2=($(echo "$UNAME" | awk -F'[.-]' '{print $2}'))
CUR_3=($(echo "$UNAME" | awk -F'[.-]' '{print $3}'))
CUR_V=($(echo "$UNAME" | awk -F'[.-]' '{print $4}'))
FOUND=0
@DylanGraham
DylanGraham / rmOldKernels.sh
Created June 13, 2017 03:39
Remove your old kernels on SUSE
#!/bin/bash
UNAME=$(uname -r)
CUR_array=($(echo "$UNAME" | awk -F'[.-]' '{print $1 "\n" $2 "\n" $3 "\n" $4}'))
CUR=$(echo ${CUR_array[@]} | tr -d ' ')
FOUND=0
function compare {
for J in {0..3}; do
if (( "${THIS_array[J]}" > "${CUR_array[J]}" )); then break
elif (( "${THIS_array[J]}" < "${CUR_array[J]}" )); then
@DylanGraham
DylanGraham / kversions
Created July 21, 2020 00:39
Get server and node versions of your k8s clusters
#!/usr/local/bin/bash
for i in $(kctx); do kctx $i; kubectl version --short | grep Server; kubectl get node --no-headers | awk {'print "Node Version:\t" $5'} | sort | uniq; echo; done
@DylanGraham
DylanGraham / update-kubectx
Created July 21, 2020 00:43
Update kubectx short names after upgrade on MacOS
#!/bin/bash
local_dir="/usr/local/bin"
kctx_dir="/usr/local/Cellar/kubectx"
cd $kctx_dir
new_dir=$(find . -type d -d 1 -name "*\.*\.*" | sed 's/^\.\///')
rm -f latest
ln -s $new_dir latest
rm $local_dir/{kubectx,kubens,kctx,kns}
ln -s $kctx_dir/$new_dir/bin/kubectx $local_dir/kctx