This file contains 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
/* | |
* Simple lockfree implementation of single producer/consumer circular FIFO buffer | |
*/ | |
#ifndef RINGBUFFER_H | |
#define RINGBUFFER_H | |
#include <algorithm> | |
#include <memory.h> | |
#include <atomic> |
This file contains 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
// Compiled with: g++ -Wall -std=c++14 -pthread | |
#include <iostream> | |
#include <mutex> | |
#include <thread> | |
#include <condition_variable> | |
#include <queue> | |
#include <thread> | |
#include <vector> | |
using namespace std; |
This file contains 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 | |
-------------------------- | |
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 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
int longest_substring(const string& str1, const string& str2) { | |
int n = str1.length(); | |
int m = str2.length(); | |
int suffix[n + 1][m + 1] = {}; | |
int result = 0; | |
This file contains 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
update apps SET no_nw_timeout = 5 where id = '49e68ee79f254ae49b344873be35668d'; | |
mysql -h rds1.packetzoom.net --ssl-ca=~/rds-combined-ca-bundle.pem -u pz_user --password=this |
This file contains 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
https://coderwall.com/p/7smjkq/multiple-ssh-keys-for-different-accounts-on-github-or-gitlab | |
chmod 400 chmod 400 ~/.ssh/id_rsa_dev | |
ssh gitlab.packetzoom.net -v |
This file contains 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
#include <iostream> | |
#include <vector> | |
using namespace std; | |
// Max Heap impl | |
struct PriorityQueue { | |
private: | |
vector<int> A; |
This file contains 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
#include <iostream> | |
using namespace std; | |
typedef struct node { | |
int data; | |
node() : data(0), left(NULL), right(NULL) {} | |
node(int d) { | |
data = d; |
This file contains 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
#include <iostream> | |
#include <list> | |
#include <stdlib.h> | |
#include <climits> | |
#include <bits/stdc++.h> | |
using namespace std; | |
class graph { |
This file contains 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
#include <iostream> | |
#include <vector> | |
#include <bitset> | |
#include <math.h> | |
#include <climits> | |
using namespace std; | |
/* | |
static string ToBinaryString(float value) { |
NewerOlder