brew install tmux
Run tmux -CC
or tmux -CC attach
in iTerm2 and then menu is shown on terminal:
- ESC to detach
- C to run commands
- X to force quit
- L for log
#ifndef QUEUE_HPP | |
#define QUEUE_HPP | |
#include <cstdio> | |
#include "semaphore.hpp" | |
/** A thread-safe queue which supports one read-thread and one write-thread | |
manipulating the queue concurrently. In other words, the thread-safe queue can | |
be used in the consumer-producer problem with one consumer and one producer. **/ | |
template<typename T> |
#include <iso646.h> | |
#include <setjmp.h> | |
#include <stdio.h> | |
// Exception Macros | |
int _exn_handler_idx = 0; | |
jmp_buf _exn_handlers[1024]; |
brew install tmux
Run tmux -CC
or tmux -CC attach
in iTerm2 and then menu is shown on terminal:
Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.
git revert {commit_id}
Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32:
Many different applications claim to support regular expressions. But what does that even mean?
Well there are lots of different regular expression engines, and they all have different feature sets and different time-space efficiencies.
The information here is just copied from: http://regular-expressions.mobi/refflavors.html
/* | |
** Binary Search Tree implementation in C++ | |
** Harish R | |
*/ | |
#include<iostream> | |
using namespace std; | |
class BST { | |
struct node { |
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 |