Skip to content

Instantly share code, notes, and snippets.

@ejmr
ejmr / for-each-subdir
Created August 17, 2018 23:01
Perform Arbitrary Commands on Immediate Subdirectories
#!/bin/sh
#
# for-each-subdir
# ===============
#
# ## SYNOPSIS
#
# $ for-each-subdir [FLAGS]
#
# ## DESCRIPTION

CLI Improved

This document lists improvements over the default Linux command line tools.

The list was initially motivated by a blog post by Remy Sharp.

CLI Tools

@jerinphilip
jerinphilip / slurm-f.sh
Created September 1, 2018 05:35
SLURM related Bash functions and aliases
function summarize-user {
check_time=$(date +%Y-%m-%d -d "7 days ago")
sacct -S $check_time -u $1 --format=User,Account,Jobname,elapsed,ncpus,AllocTRES
}
function modquota {
echo sacctmgr -i modify account $1 set GrpTRES=gres/gpu=$2 GrpTRESMin=gres/gpu=$3;
sacctmgr -i modify account $1 set GrpTRES=gres/gpu=$2 GrpTRESMin=gres/gpu=$3;
}
@skyrocknroll
skyrocknroll / Vagrantfile
Last active November 13, 2019 07:19
[Vagrant] #vagrant #multimachine
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
BOX_IMAGE = "ubuntu/xenial64"
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
@ctokheim
ctokheim / slurm_cheat_sheet.md
Last active July 6, 2024 18:08
A cheat sheet for the SLURM job scheduler

SLURM

Slurm is a job scheduler for computer clusters. This document is based on this tutorial. A useful guide showing the relationships between SGE and SLURM is available here.

Gathering information

Two commands may be useful:

  • sinfo provides information about the resouces of the cluster.
@AmazingTurtle
AmazingTurtle / how-to-restore.md
Last active October 14, 2025 22:09
restore access to unifi controller

Restore access to a unifi controller

When you are unable to login to the unifi controller or forgot admin password, you can restore access using SSH and manipulating mongodb directly.

Warning

Do not uninstall unifi controller - most of the data is not stored in mongodb. In case you thought a mongodb backup would be sufficient, you may have fucked up already, just like me. However I managed to write this "tutorial" for anyone to not run into the same trap.

Apparently this guide no longer works with recent unifi controller versions (starting nov/dec 2022). Since I no longer use unifi hardware in my home system, I can not update the guide myself. In case you've gotten here to recover your data, you're likely doomed. But giving it a try won't hurt anyway, therefore: good luck.

@crazyguitar
crazyguitar / effective_modern_cmake.md
Created August 1, 2019 07:11 — forked from mbinna/effective_modern_cmake.md
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

@youssefeldakar
youssefeldakar / sacctmins
Last active December 30, 2020 09:44
Print Slurm bank account usage/quota minutes for a given resource
#!/bin/sh
# This gist has moved under github.com/hpcalex/slurmies/ as of 2020-12-30.
# Usage: sacctmins <acct> <resc>
# Reference for Slurm commands:
#
# https://slurm.schedmd.com/sshare.html
@mmterpstra
mmterpstra / submitd.pl
Last active July 30, 2020 01:08
submitd.pl queue crawlin since 2019
#!/usr/bin/perl
use strict;
use warnings;
use Proc::Daemon;
use Proc::PID::File;
use Getopt::Long;
use Log::Log4perl qw(:easy);
use File::Basename;
@MichaelSimons
MichaelSimons / RetrievingDockerImageSizes.md
Last active October 12, 2025 21:26
Retrieving Docker Image Sizes

Retrieving Docker Image Sizes

There are two metrics that are important to consider when discussing the size of Docker images.

  1. Compressed size - This is often referred to as the wire size. This affects how fast/slow images can be pulled from a registry. This impacts the first run experience on machines where images are not cached.
  2. Uncompressed size - This is often referred to as the size on disk. This affects how much local storage is required to support your Docker workloads.

The example commands shown below will work on Windows, MacOS, and Linux.

How to Measure the Compressed Size