Skip to content

Instantly share code, notes, and snippets.

View whimbree's full-sized avatar

Bree Spektor whimbree

  • USA
View GitHub Profile
@whimbree
whimbree / install_bios_gpt.sh
Created November 19, 2023 05:46
Install NixOS on a VPS using Legacy booting on a GPT paritioned drive, with ZFS native encryption and ZFS root.
# The disk that will be used
# NOTE: If installing on an nvme drive (ie: /dev/nvme0n1), you'll need to replace all occurrences of ${DISK}# with ${DISK}p# where # is the partition number.
# Don't forget to also replace all occurences of $(echo $DISK | cut -f1 -d\ )# with $(echo $DISK | cut -f1 -d\ )p#
export DISK='/dev/vda'
export LUKS_KEY_DISK=cryptkey
export KEYFILE_LOCATION=/cryptkey
export KEY_DISK=/dev/mapper/cryptkey
# we use parted here since it does a good job with adding BIOS protective MBR to GPT disk
@whimbree
whimbree / copy-repo.md
Created August 12, 2020 01:37
Copy a repo without forking

How to copy a GitHub repo without forking

GitHub only lets you fork a repo once, if you want to make more than one copy of a project here's how you can do it. Useful for starter code.

  1. Create a new empty folder for your project and initialize git

    cd where-you-keep-your-projects

mkdir your-project-name

@whimbree
whimbree / gist:966c117ec82fd85597bdaa89e265b195
Created September 29, 2019 22:48
Lowest Common Ancestor of BST (Black Magic Recursion)
class Solution {
public:
TreeNode* lowestCommonAncestor(TreeNode* root, TreeNode* p, TreeNode* q) {
if (!root) return nullptr;
if (root->val == p->val || root->val == q->val) return root;
TreeNode* left = lowestCommonAncestor(root->left, p, q);
TreeNode* right = lowestCommonAncestor(root->right, p, q);
if (!left) return right;
if (!right) return left;
If you want to login as root using SSH or SFTP you need to edit the config of SSHD, do this:
Login, and edit this file: sudo nano /etc/ssh/sshd_config
Find this line: PermitRootLogin without-password
Edit: PermitRootLogin yes
Close and save file
reboot or restart sshd service using: /etc/init.d/ssh restart
Set a root password if there isn't one already: sudo passwd root
Now you can login as root, but I recommend you using strong password or ssh-keys