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 / 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)))'
@prehensilecode
prehensilecode / sge_cheatsheet.md
Created April 19, 2023 15:00 — forked from willfurnass/sge_cheatsheet.md
(Son of) Grid Engine tips and tricks

Random Grid Engine tips and tricks

The following work with Son of Grid Engine (SGE) 8.1.9 as configured on the University of Sheffield's ShARC and Iceberg clusters.

Jobs with dependancies

You can use the -hold_jid <<job-name or job-name>> option to make jobs run only when other jobs have finished, rather than having jobs start and sit waiting for other tasks to complete.

@prehensilecode
prehensilecode / basic_nftables
Created May 20, 2022 17:50
Basic nftables config
#! /usr/bin/nft -f
### localhost
define LOCALHOST = { 127.0.0.1 }
define LOCALHOST6 = { ::1 }
table inet filter {
chain input {
type filter hook input priority 0; policy drop;
ct state invalid counter drop comment "early drop of invalid packets"