ssh-copy-id -i [file-to-identity_file] [user]@[host]
# This command lists all your disks(internal & external)
$ diskutil list
# The result would be something like:
# /dev/disk6[this number is important] (external, physical):
# After getting this number, we should do:
- Go to https://github.com/Dreamacro/clash/releases to find the latest or the version you desired.
- Find the correct distro version, for example, if you are running a distro with arm64 archtecture, you should download
the one with
armv8
suffix. - Download the executables with curl or wget at your wish.
$ curl -O [url/to/clash]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SSH connection is under raw TCP and UDP, which was implemented in `ssh` command via `nc` or `socat` for different platform | |
# So that in order to connect to the server via proxies, we need to as these commands to do that for us. | |
# Use `man nc` or `man socat` for more detail. | |
# Put this into `/Users/username/Home/.ssh/config` | |
Host git.github.com | |
# ProxyCommand does the magic to access the proxy server. | |
ProxyCommand /bin/nc -X 5 -x 127.0.0.1:7890 %h %p |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo $(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::any::type_name; | |
fn type_of<T>(_: T) -> &'static str { | |
type_name::<T>() | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
# Senario | |
# Direcotry: /Home/uname/work/some_proj/sub_folder | |
# File in /Home/uname/work/some_proj | |
# Command would be like | |
# sh ../some_shell.sh | |
# $pwd gets the current working diretory | |
BASE_DIR="$(pwd)/$(dirname $BASH_SOURCE)" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export COOKIE_JAR='cookie-jar' | |
function _curl () { | |
curl --insecure -b $COOKIE_JAR -c $COOKIE_JAR -s "$@" | |
} | |
export -f _curl |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Parse command line arguments in a pattern like --flag value | |
while (( "$#" )); do | |
case "$1" in | |
-f|--flag) | |
statement | |
shift 2 | |
;; |
-b filename - Block special file
-c filename - Special character file
-d directoryname - Check for directory Existence
-e filename - Check for file existence, regardless of type (node, directory, socket, etc.)
-f filename - Check for regular file existence not a directory
NewerOlder