Skip to content

Instantly share code, notes, and snippets.

View fanurs's full-sized avatar
🇲🇾
:atom:

Fanurs fanurs

🇲🇾
:atom:
View GitHub Profile
@fanurs
fanurs / .condarc
Last active November 20, 2023 19:41
Template for `~/.condarc`
env_prompt: '($(basename {default_env})) '
channels:
- defaults
- conda-forge
pkgs_dirs:
- /optional/directory/in/case/your/home/directory/is/small/.conda/pkgs
#!/bin/bash
TIMEOUT=60 # in seconds
TIMESTEP=3 # in seconds
JOB_NAME="tunnel" # any unique name
SCRIPT="/path/to/interactive.sbatch" # modify accordingly
# It starts an OpenSSH server to enable interactive sessions, allowing IDEs like VSCode to connect remotely.
# Here is an example script: https://crc-pages.pitt.edu/user-manual/slurm/vscode/#steps-performed-only-once
main () {
@fanurs
fanurs / rclone-gdrive.md
Created June 27, 2024 21:47
Some common rclone (Google Drive)

Setup rclone for Google Drive on a Remote Linux Server

Installation

Install rclone:

sudo apt update
sudo apt install rclone

Configuration

First, create a local directory that you want to mount the remote filesystem:

mkdir remote-mount

Assume that SSH configuration has already been set up for the remote server.

sshfs -o ro,default_permissions remote:/some/target/directory remote-mount
  1. Git clone the repo
git clone https://github.com/fanurs/data-analysis-e15190-e14030.git
  1. Make sure that conda is available. This means that you should have activated your anaconda or miniconda installations. To check,
which conda

If you see some path to conda, then it's good. If not, that means somehow it's not activated yet. You could do something like:

@fanurs
fanurs / generate_ssh_key.sh
Last active February 22, 2025 19:29
To generate ssh key pair whose public key BASE64 encoding matches a certain substring
#!/bin/bash
# This script offers a fun way to generate an SSH key whose public key's BASE64
# encoding would end in a certain substring you specify. The script simply
# keeps trying until to find one. Because the probability distribution is
# geometric, so in practice, it is not "that bad" if you just want to match to
# last two characters.
# Ensure script is run from ~/.ssh
if [[ "$(pwd)" != "$HOME/.ssh" ]]; then
echo "Error: This script must be run from ~/.ssh"
@fanurs
fanurs / pandoc-md-to-pdf.sh
Created February 28, 2025 01:53
A script to convert Markdown to PDF
#!/bin/bash
# Check if input file is provided
if [ $# -ne 1 ]; then
echo "Usage: $0 input.md"
exit 1
fi
# Get the input file
INPUT_FILE="$1"