Skip to content

Instantly share code, notes, and snippets.

@jdeng
jdeng / sparse_set.h
Created July 31, 2014 05:17
Sparse set
#pragma once
// Using Uninitialized Memory for Fun and Profit
// http://research.swtch.com/sparse
#include <vector>
class SparseSet
{
private:
size_t n_;
std::vector<uint32_t> dense_, sparse_;
@jdeng
jdeng / Pass.java
Created September 29, 2014 00:02
Pass
import java.util.Map;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.io.*;
public class Pass
{
public static void main(String[] arg)
{
try {
@jdeng
jdeng / pdf2img.html
Created February 11, 2015 02:54
pdf to image using pdf.js
<html>
<body>
<script type="text/javascript" src="//mozilla.github.io/pdf.js/build/pdf.js"></script>
<script type="text/javascript">
var url = "https://docs.google.com/document/export?format=pdf&id=1ML11ZyyMpnAr6clIAwWrXD53pQgNR-DppMYwt9XvE6s&token=AC4w5Vg7fSWH1Hq0SgNckx4YCvnGPaScyw%3A1423618416864";
var pages = [], heights = [], width = 0, height = 0, currentPage = 1;
var scale = 1.5;
function draw() {
@jdeng
jdeng / convert.go
Created October 20, 2017 05:49
Save Outlook mail to MIME format using golang
// +build windows
package main
import (
"fmt"
"time"
"syscall"
"unsafe"
@jdeng
jdeng / test.go
Created July 25, 2020 04:27
restic + rclone as a library example
package main
import (
"bytes"
"context"
"flag"
"fmt"
// "os"
"path"