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 "websocket.h" | |
#include "../common/string-util.h" | |
bool ws_handshake_assemble(byte* buf, u_int len, std::string& request, u_int& readLen) | |
{ | |
if (len < 4) | |
return false; | |
//http head is end with an empty line | |
if ( buf[len-4] == '\r' |
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
package main | |
import ( | |
"fmt" | |
"sync/atomic" | |
"time" | |
) | |
type atomicObject struct { | |
physical time.Time |
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
package main | |
import ( | |
"container/heap" | |
"flag" | |
"fmt" | |
"math/rand" | |
"time" | |
) |
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
package main | |
import ( | |
"flag" | |
"log" | |
"strings" | |
"sync/atomic" | |
"time" | |
"github.com/pingcap/network" |
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
package main | |
import ( | |
"context" | |
"flag" | |
"fmt" | |
"log" | |
"math/rand" | |
"time" |
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
function tagInbox() { | |
var now = new Date(); | |
var threads = GmailApp.getInboxThreads(); | |
for (var i = 0; i < threads.length; i++) { | |
var thread = threads[i]; | |
var messages = thread.getMessages(); | |
for (var j = messages.length-1; j >= 0; j--) { | |
var message = messages[j]; | |
if (now - message.getDate() > 30*60*1000) { // ignore mails from more than 0.5h ago. | |
break; |
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
For blog post http://disksing.com/failure-probability-analysis/ |
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
FROM ubuntu | |
RUN apt-get update && \ | |
apt-get install -y curl zip jq git && \ | |
mkdir /tmp/install && cd /tmp/install && \ | |
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \ | |
unzip awscliv2.zip && \ | |
./aws/install && \ | |
curl "https://releases.hashicorp.com/terraform/0.12.28/terraform_0.12.28_linux_amd64.zip" -o "terraform_0.12.28_linux_amd64.zip" && \ | |
unzip terraform_0.12.28_linux_amd64.zip && \ |
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
#!/bin/bash | |
# Add missing DCOs for current branch (starting from merge base to master) | |
# Following commit history as an example, this script will affect commits E,F,G. | |
# | |
# v master | |
# A - B - C - D - H - I | |
# \ | |
# E - F - G | |
# ^ feature (HEAD) |
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
package main | |
import ( | |
"bytes" | |
"context" | |
"flag" | |
"fmt" | |
"log" | |
"math/rand" | |
"time" |
OlderNewer