Skip to content

Instantly share code, notes, and snippets.

View ty-cs's full-sized avatar
🎯
Focusing

Tianyu Li ty-cs

🎯
Focusing
  • Earth
View GitHub Profile
@ty-cs
ty-cs / docker-help.md
Created July 17, 2021 11:33 — forked from bradtraversy/docker-help.md
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

@ty-cs
ty-cs / tmux.md
Created July 24, 2019 06:54 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@ty-cs
ty-cs / latency.txt
Created May 24, 2019 11:02 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
# You can download this config from: http://surge.run/config-example/ios.conf
# Edit with your computer and copy back to iOS device via iTunes, URL, AirDrop
# or iCloud Drive
# Version 2.0
[General]
# Log level: warning, notify, info, verbose (Default: notify)
loglevel = notify
# Skip domain or IP range. These hosts will not be processed by Surge Proxy.
# (In macOS version when Set as System Proxy enabled, these hosts will be
@ty-cs
ty-cs / mysql-docker.sh
Created April 19, 2019 15:24 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@ty-cs
ty-cs / README-Template.md
Created January 3, 2019 15:08 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@ty-cs
ty-cs / multiple_ssh_setting.md
Created December 20, 2018 09:17 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@ty-cs
ty-cs / generate-ssh-key.sh
Created December 20, 2018 09:15 — forked from grenade/01-generate-ed25519-ssh-key.sh
Correct file permissions for ssh keys and config.
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/id_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/github_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/mozilla_rsa
@ty-cs
ty-cs / flatten.js
Created September 28, 2018 15:55
flatten.js
const flatten =
(arr, depth = Infinity) =>
arr.reduce(
(list, v) =>
list.concat(
depth > 0 ?
(depth > 1 && Array.isArray(v) ?
flatten(v, depth - 1) :
v
) :
@ty-cs
ty-cs / android_instructions.md
Created September 10, 2018 10:17 — forked from patrickhammond/android_instructions.md
Easily setup an Android development environment on a Mac

Here is a high level overview for what you need to do to get most of an Android environment setup and maintained.

Prerequisites (for Homebrew at a minimum, lots of other tools need these too):

  • XCode is installed (via the App Store)
  • XCode command line tools are installed (xcode-select --install will prompt up a dialog)
  • Java

Install Homebrew:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"