Skip to content

Instantly share code, notes, and snippets.

View compile_time_regex.cc
template <typename Left, typename Right>
struct ConcatExpr;
template <typename Left, typename Right>
struct AltExpr;
template <typename SubExpr>
struct RepeatExpr;
template <typename SubExpr>
View test.c
#include <stdio.h>
#include <string.h>
#include <pthread.h>
int x;
int y;
int a;
int b;
void* f1(void* arg)
View test.go
package main
import "sync"
func main() {
for {
x := 0
y := 0
a := 0
b := 0
View portforward
package main
import (
"net"
"fmt"
"io"
"os"
)
func handle(source net.Conn) {
View gist:7a4a0e7ff74901ceb889
#include <string>
#include <cstring>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <cerrno>
#include <stdexcept>
#include <sys/wait.h>
View gist:5527363c7f9d018af414
/**
* Definition for binary tree
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
View gist:61cee22d8d2422e49f6c
import urllib2
import urllib
headers = {
"X-Auth-Token": "xxxx",
"Content-Type": "application/json"
}
data = {
"id": "alert",
View gist:10615719
f, err := os.OpenFile("Registry", os.O_RDWR, 0644)
if err != nil {
log.Fatal(err)
}
defer f.Close()
enc := unicode.UTF16(unicode.LittleEndian, unicode.ExpectBOM)
tf := enc.NewDecoder()
tr := transform.NewReader(f, tf)
View gist:10441529
package main
import (
"bytes"
"crypto/cipher"
"crypto/des"
"crypto/rand"
"crypto/rsa"
"encoding/base64"
"flag"
View gist:9978572
def isSame(a, b):
return a==b
last = None
def f(sum, b):
global last
first = b[0]
if isSame(last, first):
sum[-1].extend(b[1:])
else:
You can’t perform that action at this time.