Skip to content

Instantly share code, notes, and snippets.

open Lwt
let listen_addr = Unix.inet_addr_loopback
let port = 5432
(* Shared mutable counter *)
let counter = ref 0
let max_pending_req = 10
@higuoxing
higuoxing / delete_git_submodule.md
Created August 29, 2022 07:20 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@higuoxing
higuoxing / key.private
Last active May 6, 2022 13:55
Ignorance is bliss
-----BEGIN PGP PRIVATE KEY BLOCK-----
lQVYBGJ1JsEBDADkT39/Qom8A3bO5Ym3L0R3B/Yg/P6Hm5n0pNYTv2ic9AhO9LN6
AlapqAwYej9EXtdiUJOURgCz9wUspI/B1nDklg6WwnpXckmL3bWerQK+ibLics72
sr8PjQq89USSQ8ijjrz5mDcsXCrLKP2CADi4pL577zijDoJiiEWhSFeKxvmvJQTx
9m0dJHz/IwSS/YsMXnMotn2SUjZT5dc1y40GOgw3TKbti85hmyJRisVdGcxejTvJ
g9QkHAzypUZlCswSDfOB+MwBCMuCkOR0IyoTf2mCVCM3ELj3seehpBqNJTUnZ0R2
wRbZNLi915I3izK7HPuLA8HX2aVopjI7joynIWNSUuyJmLY5gX50DZ4TgEdaCMEF
xqrOfhSDVvR06Ktvee95GbX7l/aZ25owjxSilu1tqEYQV3Zo4KQ69dcnvVoeZpTW
M0VrmxAvkqoRkBX7Jl0HXDu/D7Ee2rIKrKM9Lk5yPgaEjSC85XEB6Fbq8mdlCOLi
@higuoxing
higuoxing / puf_core.v
Last active March 14, 2022 02:22
Verilog implementation of physical unclonable function (PUF).
module puf_cell (
input [0:0] clk_i,
input [0:0] rst_i,
input [0:0] latch_i,
input [0:0] sample_i,
output [0:0] data_o
);
reg [0:0] osc;
reg [0:0] data_o_reg;
@higuoxing
higuoxing / seu-fuckoff.py
Created October 30, 2021 10:03
一个恶作剧脚本
#!/usr/bin/env python3
## Usage:
## 1. 查看某个一卡通登录信息.
## $ seu-fuckoff.py -u <一卡通>
## 2. 将某个一卡通对应的终端踢下线.
## $ seu-fuckoff.py -f -u <一卡通>
import argparse
import requests
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@higuoxing
higuoxing / naive-hashtable.cc
Created March 26, 2021 03:22
Naive HashTable
#include <iostream>
#include <list>
#include <vector>
template <typename K, typename V> struct HashEntry {
K _key;
V _value;
};
template <typename K, typename V> struct Bucket {
@higuoxing
higuoxing / gitproxy-socat
Created January 10, 2021 10:13 — forked from sit/gitproxy-socat
A simple wrapper around socat to use as a git proxy command
#!/bin/sh
# Use socat to proxy git through an HTTP CONNECT firewall.
# Useful if you are trying to clone git:// from inside a company.
# Requires that the proxy allows CONNECT to port 9418.
#
# Save this file as gitproxy somewhere in your path (e.g., ~/bin) and then run
# chmod +x gitproxy
# git config --global core.gitproxy gitproxy
#
# More details at http://tinyurl.com/8xvpny
@higuoxing
higuoxing / homework_summary.py
Last active October 12, 2020 08:29
QQ 群作业汇总
from openpyxl import Workbook
from openpyxl.styles import Color, PatternFill, Font, Border, colors, fills
from openpyxl import load_workbook
from datetime import datetime
def parse_sheet(wb):
students = []
for i, r in enumerate(wb[wb.sheetnames[0]].rows):
if i <= 1 or r[0].value == None or '助教' in r[0].value:
continue
@higuoxing
higuoxing / mandelbrot.c
Created November 7, 2019 03:31
C code for generating mandelbrot set.
#include <stdio.h>
#include <math.h>
#define PPM_FILE_NAME "mandelbrot.ppm"
#define COMMENT "# This is an image on mandelbrot set"
#define IMAGE_WIDTH 800
#define IMAGE_HEIGHT 800
#define MAX_COLOR_VALUE 255
#define CX_MIN (-2.5 - 0.5) / 1.9