Skip to content

Instantly share code, notes, and snippets.

@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.
@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;
}

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

@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
@coin8086
coin8086 / using-proxy-for-git-or-github.md
Last active September 21, 2025 16:28
Use Proxy for Git/GitHub

Use Proxy for Git/GitHub

Generally, the Git proxy configuration depends on the Git Server Protocol you use. And there're two common protocols: SSH and HTTP/HTTPS. Both require a proxy setup already. In the following, I assume a SOCKS5 proxy set up on localhost:1080. But it can also be a HTTP proxy. I'll talk about how to set up a SOCKS5 proxy later.

SSH Protocol

When you do git clone ssh://[user@]server/project.git or git clone [user@]server:project.git, you're using the SSH protocol. You need to configurate your SSH client to use a proxy. Add the following to your SSH config file, say ~/.ssh/config:

ProxyCommand nc -x localhost:1080 %h %p
@pansapiens
pansapiens / .bashrc
Last active July 26, 2024 00:58
Some SLURM aliases
alias default_account='sacctmgr --parsable2 show user -s andrewpe | tail -1 | cut -f 2 -d '\''|'\'''
alias fairshare='sshare -a --accounts $(default_account)'
alias jhistory='sacct -u ${USER} --starttime $(date -d "-1 month" +%Y-%m-%d) --format=User,JobID,Jobname,partition,state,exitcode,time,start,end,elapsed,MaxRss,MaxVMSize,nnodes,ncpus,nodelist'
alias jshow='scontrol show job'
alias jinfo='sacct --starttime $(date -d "-1 month" +%Y-%m-%d) --format=User,JobID,Jobname%64,partition,qos,ReqCPUS,ReqMem,state,exitcode,time,start,end,elapsed,MaxRss,MaxVMSize,nnodes,ncpus,nodelist -j'
alias node_types='sinfo -o '\''%c %m %n %R'\'' --sort '\''P'\'''
alias qhogs='sreport cluster UserUtilizationByAccount -t hours'
alias si='sinfo -o "%20P %5D %14F %8z %10c %10m %10d %11l %16f %N"'
alias sq='squeue -o "%8i %.60j %4t %10u %20q %20a %10g %20P %10Q %5D %2C %5m %11l %11L %R"'
alias squ='squeue -u $USER --format="%.18i %.9P %.60j %.8u %.8a %.2t %.10M %.6D %R"'
@ejmr
ejmr / git-ls-github-repos.sh
Created May 15, 2018 17:55
Display URLs for all public GitHub repositories of a given user
#!/bin/sh
#
# git-ls-github-repos(1) - list a user's GitHub repositories
# ==========================================================
#
# ## SYNOPSIS
#
# `git-ls-github-repos` <user>
#
# ## REQUIREMENTS
@truatpasteurdotfr
truatpasteurdotfr / grepcidr.spec
Created April 9, 2018 07:33
grepcidr spec file
Name: grepcidr
Version: 2.0
Summary: grepcidr 2.0 - Filter IPv4 and IPv6 addresses matching CIDR patterns
Group: Applications/Productivity
URL: http://www.pc-tools.net/unix/grepcidr/
Source: http://www.pc-tools.net/files/unix/grepcidr-2.0.tar.gz
Vendor: Jem Berkes <[email protected]>
Packager: Tru Huynh <[email protected]>
License: GPLv3
Release: 1%{?dist}
@ozancaglayan
ozancaglayan / slurm_aliases.rc
Last active April 23, 2024 12:43
Aliases for SLURM
###############
# SINFO aliases
###############
# Detailed sinfo
alias si="sinfo -o '%8P %10n %.11T %.4c %.8z %.6m %12G %10l %10L %10O %20E' -S '-P'"
# sinfo only on GPU partition
alias sig="si -p gpu"
# sinfo only on CPU partition
alias sic="si -p cpu"
#!/usr/bin/env bash
set -x
if ! which brew; then
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
brew analytics off