Function | Shortcut |
---|---|
New Tab | ⌘ + T |
Close Tab or Window | ⌘ + W (same as many mac apps) |
Go to Tab | ⌘ + Number Key (ie: ⌘2 is 2nd tab) |
Go to Split Pane by Direction | ⌘ + Option + Arrow Key |
Cycle iTerm Windows | ⌘ + backtick (true of all mac apps and works with desktops/mission control) |
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
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 |
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
apiVersion: rbac.authorization.k8s.io/v1beta1 | |
kind: ClusterRoleBinding | |
metadata: | |
name: kubernetes-dashboard | |
labels: | |
k8s-app: kubernetes-dashboard | |
roleRef: | |
apiGroup: rbac.authorization.k8s.io | |
kind: ClusterRole | |
name: cluster-admin |
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
// BinarySearch ... | |
func BinarySearch(array []int, target int) int { | |
low := 0 | |
high := len(array) - 1 | |
mid := 0 | |
for low <= high { | |
mid = (low + high) / 2 | |
if array[mid] > target { | |
high = mid - 1 | |
} else if array[mid] < target { |
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
// UpperBound ... | |
func UpperBound(array []int, target int) int { | |
low, high, mid := 0, len(array)-1, 0 | |
for low <= high { | |
mid = (low + high) / 2 | |
if array[mid] > target { | |
high = mid - 1 | |
} else { | |
low = mid + 1 |
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
// LowerBound ... | |
func LowerBound(array []int, target int) int { | |
low, high, mid := 0, len(array)-1, 0 | |
for low <= high { | |
mid = (low + high) / 2 | |
if array[mid] >= target { | |
high = mid - 1 | |
} else { | |
low = mid + 1 | |
} |
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
bool searchMatrix(vector<vector<int>>& matrix, int target) { | |
if (matrix.size() == 0 || matrix[0].size() == 0) return false; | |
int row = matrix.size(); | |
int col = matrix[0].size(); | |
int low = 0; | |
int high = row * col - 1; | |
while (low <= high) | |
{ |
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
map<string, multiset<string> > adj; | |
vector<string> result; // reverse the result if you are trying to find a path that starts from u. | |
void dfs(string u) { | |
while(adj[u].size()) { | |
string v = *adj[u].begin(); | |
adj[u].erase(adj[u].begin()); | |
dfs(v); | |
} | |
return result.push_back(u); |
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
priority_queue<pair<int,int>, vector<pair<int,int>>, greater<pair<int,int>>> pq; | |
/* | |
top : 9 4 | |
top : 10 5 | |
top : 10 8 | |
top : 15 10 | |
*/ |
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
vector<int> maxSlidingWindow(vector<int>& nums, int k) { | |
deque<pair<int,int>> q; | |
vector<int> ret; | |
for(int i = 0;i<nums.size();i++) { | |
while(q.size() && q.back().first <= nums[i]) q.pop_back(); | |
q.push_back({nums[i],i}); | |
while(q.front().second <= (i-k)) q.pop_front(); | |
if(i + 1 >= k) ret.push_back(q.front().first); | |
} | |
return ret; |
OlderNewer