Skip to content

Instantly share code, notes, and snippets.

@prehensilecode
prehensilecode / tunnel_to_cluster_node_mgmt_port.md
Last active March 6, 2024 16:32
Tunnel to cluster node XCC or DRAC

Set up tunnel:

 ssh -L 1443:clusternode-xcc:443 adminuser@adminhost

Then, run web browser on PC connecting to

https://localhost:1443
@prehensilecode
prehensilecode / cron_helper.sh
Last active March 6, 2024 15:06 — forked from liquidgecka/cron_helper.sh
Cron helper
#!/bin/bash
usage() {
cat << EOF
Usage: $0 [OPTION]... COMMAND
Execute the given command in a way that works safely with cron. This should
typically be used inside of a cron job definition like so:
* * * * * $(which "$0") [OPTION]... COMMAND
Arguments:
@prehensilecode
prehensilecode / ncbi_ngs_build_rhel8.md
Last active November 2, 2023 00:35
HOWTO Build NCBI NGS on RHEL 8
@prehensilecode
prehensilecode / oh_my_zsh_tips.md
Last active October 26, 2023 19:49
Oh My Zsh tips

Oh My Zsh tips

  • To see all 256 possible colors and their IDs:
    • spectrum_ls
    • spectrum_bls
  • for i in {0..255}; do print -Pn "%K{$i} %k%F{$i}${(l:3::0:)i}%f " ${${(M)$((i%6)):#3}:+$'\n'}; done
@prehensilecode
prehensilecode / HOWTO_build_NCI-GDC-gdc_client.md
Last active September 11, 2023 14:36
HOWTO build NCI-GDC/gdc_client

HOWTO build NCI-GDC/gdc_client

Notes on building https://github.com/NCI-GDC/gdc-client

Issue

Following their instructions, get error in building lxml Python package:

Building wheels for collected packages: lxml
  Building wheel for lxml (setup.py): started
@prehensilecode
prehensilecode / HOWTO link R with OpenBLAS.md
Last active August 8, 2023 13:06
Building and linking R with OpenBLAS
@prehensilecode
prehensilecode / find_broken_sudoers.py
Last active June 7, 2023 18:43
Find nonexistent users in a sudoers file
#!/usr/bin/env python3
import sys
import os
import re
import pwd
# some of the User_Aliases lines contain buggy usernames
# which have "a" at the end of the username
broken_usernames = set()
@prehensilecode
prehensilecode / git_mv_files_only.sh
Created May 19, 2023 16:07
`git mv` all files but not directories into a subdirectory
mkdir bin
find . -not -type d -and -not -path '*/\.git/*' -exec git mv {} bin \;
TIL
- tree [dirname] : shows an ASCII-formatted tree of directory *dirname*
@prehensilecode
prehensilecode / hash_a_password.txt
Created April 20, 2023 14:03
Generating a Linux password hash (aka encrypted password)
python3 -c 'import crypt,getpass; print(crypt.crypt(getpass.getpass(), crypt.mksalt(crypt.METHOD_SHA512)))'