Skip to content

Instantly share code, notes, and snippets.

template <typename Left, typename Right>
struct ConcatExpr;
template <typename Left, typename Right>
struct AltExpr;
template <typename SubExpr>
struct RepeatExpr;
template <typename SubExpr>
@hongruiqi
hongruiqi / test.c
Last active November 29, 2015 14:44
test
#include <stdio.h>
#include <string.h>
#include <pthread.h>
int x;
int y;
int a;
int b;
void* f1(void* arg)
@hongruiqi
hongruiqi / test.go
Created November 29, 2015 14:07
funny
package main
import "sync"
func main() {
for {
x := 0
y := 0
a := 0
b := 0
package main
import (
"net"
"fmt"
"io"
"os"
)
func handle(source net.Conn) {
#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>
/**
* Definition for binary tree
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
import urllib2
import urllib
headers = {
"X-Auth-Token": "xxxx",
"Content-Type": "application/json"
}
data = {
"id": "alert",
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)
package main
import (
"bytes"
"crypto/cipher"
"crypto/des"
"crypto/rand"
"crypto/rsa"
"encoding/base64"
"flag"
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: