Skip to content

Instantly share code, notes, and snippets.

View adzcai's full-sized avatar
:octocat:

Alexander Cai adzcai

:octocat:
View GitHub Profile
@adzcai
adzcai / all.js
Created March 4, 2023 18:07
Scrape arXiv categories from https://arxiv.org/category_taxonomy
const categories = document.querySelector("#category_taxonomy_list");
// get each h2 and div pair from categories
const categoryPairs = Array.from(categories.children).filter(
(child) => child.tagName === "H2" || child.tagName === "DIV"
);
// group the h2 and div pairs into an array of arrays
const categoryGroups = [];
for (let i = 0; i < categoryPairs.length; i += 2) {
categoryGroups.push(categoryPairs.slice(i, i + 2));
@adzcai
adzcai / sstable_to_arrow_demo.py
Created August 16, 2021 13:51
A sample client for using sstable-to-arrow.
import pyarrow as pa
import socket
HOST = '127.0.0.1'
PORT = 9143
def read_bytes(sock, n):
data = b''
while len(data) < n:
more = sock.recv(n - len(data))
@adzcai
adzcai / CMakeLists.txt
Last active August 19, 2021 16:27
Getting started with Boost.Python and CMake
cmake_minimum_required(VERSION 3.16)
project(hello_cmake_boost_python)
# find the python include libraries on our system and our boost installation
find_package(Python3 REQUIRED COMPONENTS Development NumPy)
find_package(Boost REQUIRED COMPONENTS python3)
find_package(Arrow REQUIRED)
# create our "hello" shared library (.so) which will be imported from Python
add_library(hello SHARED hello.cpp)
@adzcai
adzcai / vint.js
Created July 12, 2021 15:11
JavaScript variable integer (vint) definition for debugging using the Kaitai Web IDE.
class Vint {
constructor(_io) {
this._io = _io;
}
_read() {
this.val = this._io.readU1();
// negative value
if ((this.val & 0x80) > 0) {