Skip to content

Instantly share code, notes, and snippets.

@ikirker
ikirker / bash_msg.sh
Last active May 23, 2023 12:12
A copy/pastable snippet for logging from bash scripts
function logdate() {
date +"%Y-%m-%d %H:%M:%S %Z"
}
function msg() {
if [[ "$#" -ne 2 ]]; then
printf "[%s] %s: (%s) %s" "$(logdate)" "$0" "fatal" "incorrect number of arguments provided to msg function"
exit 1
fi
@ikirker
ikirker / 1.sh
Created October 2, 2020 15:13
Some extremely contrived small shell scripts about export
#!/bin/bash
food=banana
bash -c 'echo ${food:-(no value)}'
export food
bash -c 'echo ${food:-(no value)}'
@ikirker
ikirker / LICENSE
Last active July 14, 2018 00:48
Quality of Guess -- SGE Version
In case it's relevant, the code in the file `qog` in
the same Github gist as this file should be treated
as being released under the CC-0 1.0 license, as described
at the following link:
https://creativecommons.org/publicdomain/zero/1.0/legalcode
@ikirker
ikirker / callstack.sh
Last active May 23, 2023 22:31
A quick experiment with printing callstacks in bash
#!/usr/bin/env bash
function callstack() {
echo --- Trace: ---
local i
# These arrays start at index 0, but 0 is this callstack function, so skip it.
for ((i=1; i<${#FUNCNAME[*]}; i++)) do
if [ $i -ne 1 ]; then
echo -n " "
fi
@ikirker
ikirker / bits2double.c
Last active November 29, 2016 21:38
bits2double
#include <stdio.h>
typedef union {
double d;
unsigned long long i;
struct {
unsigned long long mantissa : 52;
unsigned int exponent : 11;
unsigned int sign : 1;
} parts;
} double_cast;
@ikirker
ikirker / SC16_Notes.md
Last active November 24, 2016 11:04
SC16 Notes

SC16 Notes

Day 1 - Sunday

HUST Workshop

  • HPC User Support Tools
  • hust16.github.io

Talk 1: Sanity Tool

@ikirker
ikirker / spark-demo.sh
Last active October 10, 2017 20:07
A Spark Job Submission Script for Legion/Grace. Ugh, it's horrible.
#!/usr/bin/bash -l
# Request 10 minutes of runtime
#$ -l h_rt=4:00:00
# Request 32 cores
#$ -pe mpi 32
# Don't share nodes: managing Spark core allocation within a node is fiddly and this is easier
#$ -ac exclusive
@ikirker
ikirker / pgf_demo.tex
Last active August 26, 2016 00:17
A quick-ish practice based on an R plotting demo
\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
\pgfplotsset {width=15cm, compat=1.12}
\begin{tikzpicture}
%\pgfplotsset {small}
\pgfplotsset{every tick label/.append style={font=\small}}
\matrix [column sep=5mm] {
@ikirker
ikirker / webserver.go
Last active August 16, 2016 11:30 — forked from alexisrobert/webserver.go
Tiny web server in Go for sharing a folder
/* Tiny web server in Golang for sharing a folder
Copyright (c) 2010-2014 Alexis ROBERT <[email protected]>
Alterations to be able to serve files from /proc by Ian Kirker <[email protected]>
Contains some code from Golang's http.ServeFile method, and
uses lighttpd's directory listing HTML template. */
package main
import (
@ikirker
ikirker / checkjob.jsv
Last active November 18, 2015 14:33
JSV User-End Checking
#!/usr/bin/perl
use strict;
use warnings;
no warnings qw/uninitialized/;
use File::stat;
use Cwd;
use Env qw(SGE_ROOT);