Skip to content

Instantly share code, notes, and snippets.

@jia3857
jia3857 / .screenrc
Created June 19, 2021 05:38 — forked from bcomnes/.screenrc
ssh agent forwarding in tmux and gnu screen
# Fix agent forwarding
# https://gist.github.com/martijnvermaat/8070533
# http://techblog.appnexus.com/2011/managing-ssh-sockets-in-gnu-screen/
# See .ssh/rc for socket linking
unsetenv SSH_AUTH_SOCK
setenv SSH_AUTH_SOCK $HOME/.ssh/ssh_auth_sock.$HOSTNAME
@jia3857
jia3857 / 1-macOS-10.14-mojave-setup.md
Created May 17, 2021 02:07 — forked from kevinelliott/1-macOS-10.14-mojave-setup.md
macOS 10.14 Mojave Mostly-Automated Setup

To support my open-source work, consider adding me on Patreon.

macOS 10.14 Mojave Mostly-Automated Setup

An easy to refer to document for regularly setting up macOS 10.14 Mojave.

Controversy

The topic of recipe-based frequent fresh reinstalls of macOS is a controversial issue. Some people are against reinstalling macOS, citing that they have never had an issue with Apple provided upgrade installs.

@jia3857
jia3857 / [Facebook]lca.cpp
Created July 26, 2020 09:48 — forked from skxie/[Facebook]lca.cpp
find lowest common ancestor with parent pointer. #fb #lca #tree #binarytree O(1) space and O(n) time.
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode *parent;
TreeNode(int x) : val(x), left(NULL), right(NULL), parent(NULL) {}
};
int getHeight(TreeNode *node) {
int height = 0;
@jia3857
jia3857 / osx_setup.md
Created June 25, 2020 18:01 — forked from millermedeiros/osx_setup.md
Mac OS X setup

Setup Mac OS X

I've done the same process every couple years since 2013 (Mountain Lion, Mavericks, High Sierra, Catalina) and I updated the Gist each time I've done it.

I kinda regret for not using something like Boxen (or anything similar) to automate the process, but TBH I only actually needed to these steps once every couple years...

@jia3857
jia3857 / duplicates.py
Created March 13, 2020 02:32 — forked from tfeldmann/duplicates.py
Fast duplicate file finder written in python
#!/usr/bin/env python
"""
Fast duplicate file finder.
Usage: duplicates.py <folder> [<folder>...]
Based on https://stackoverflow.com/a/36113168/300783
Modified for Python3 with some small code improvements.
"""
import os
import sys
@jia3857
jia3857 / ls.rst
Created October 8, 2019 17:18 — forked from amitsaha/ls.rst
How does `ls` work?

How does ls work?

I wanted to be really able to explain to a fair amount of detail how does the program :command:`ls` actually work right from the moment you type the command name and hit ENTER. What goes on in user space and and in kernel space? This is my attempt and what I have learned so far on Linux (Fedora 19, 3.x kernel).

How does the shell find the location of 'ls' ?