View BlockReadWriter.go
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" | |
"bytes" | |
"os" | |
"log" | |
"time" | |
"io" | |
"http" |
View sprint_int.c
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 <stdint.h> | |
#include <stdio.h> | |
char *sprint_int_(char *out, uint64_t a, uint64_t base) { | |
char itoc[] = "0123456789abcdef"; | |
char *orig_out = out; | |
uint64_t a_ = a; | |
int i = 0; | |
while (a_ >= base) { | |
a_ /= base; | |
i++; |
View frag.go
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
// This tiny program show how to cause fragmentation in golang, killing it | |
// even though no real memory is actually used. | |
// Compile: | |
// $ go build frag.go | |
// Run: | |
// $ time (setrlimit $[100*1000];./frag) | |
// .....(until it crashes) | |
package main | |
import "fmt" |
View SparkEventSource.java
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 com.spark; | |
import org.eclipse.jetty.server.Server; | |
import org.eclipse.jetty.server.handler.HandlerList; | |
import org.eclipse.jetty.servlet.*; | |
import org.eclipse.jetty.servlets.EventSource; | |
import org.eclipse.jetty.servlets.EventSourceServlet; | |
import spark.Service; | |
import spark.Spark; | |
import spark.embeddedserver.jetty.EmbeddedJettyServer; |
View cp.go
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 cp | |
import ( | |
"io" | |
"os" | |
) | |
func cp(dst, src string) error { | |
s, err := os.Open(src) | |
if err != nil { |
View stack_size.c
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
// We demonstrate how to get the stack usage of a function | |
// using the __builtin_frame_address function of GCC and clang. | |
// | |
// This function returns: | |
// The frame is the area on the stack that holds local variables and saved registers. | |
// The frame address is normally the address of the first word pushed on to | |
// the stack by the function. | |
// | |
// by saving its value and comparing it to a callee, we get the stack usage of this | |
// function. |
View simple_transform_before_zstd.c
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 <stdio.h> | |
#include <stdlib.h> | |
#include <stdint.h> | |
#include <fcntl.h> | |
#include <sys/types.h> | |
#include <sys/stat.h> | |
#include <time.h> | |
#include <unistd.h> | |
char buf[1024*1024]; |
View bench_comp_decomp.py
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
#!/usr/bin/python3 | |
import argparse | |
from collections import namedtuple | |
import csv | |
import os | |
import shutil | |
import subprocess | |
import statistics | |
import re |
View test_vec_to_c.py
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
# This converts test vectors from | |
# https://csrc.nist.gov/Projects/cryptographic-algorithm-validation-program/CAVP-TESTING-BLOCK-CIPHER-MODES | |
# to a C-struct format. | |
# For example to initialize | |
# struct test_case { | |
# int count; | |
# int data_unit_len; | |
# std::string key; | |
# std::string index; | |
# std::string plaintext; |
View uuid4sym.py
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
#!/usr/bin/python3 | |
# -*- coding: utf-8 -*- | |
"""uuid4sym - replace UUID version 4 to an easily distinguishable symbol | |
When looking at a long log file with some UUID4 uuids, you'll have a hard time | |
distinguishing between two UUIDs. | |
Both 26cb1b84-7748-11e9-9437-2bf0efaa1b2e and 2725e8de-7748-11e9-a9c8-f3e5d10ab3d6 | |
looks similar to the human eye. |
NewerOlder