Skip to content

Instantly share code, notes, and snippets.

View lujiajing1126's full-sized avatar
🐱
Revenia ut Bestia

Jiajing LU lujiajing1126

🐱
Revenia ut Bestia
View GitHub Profile
@lujiajing1126
lujiajing1126 / HashMapLoadFactorBenchmark.java
Created May 2, 2022 06:02
Load factor banchmark for HashMap
package com.example;
import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.infra.Blackhole;
import org.openjdk.jmh.profile.GCProfiler;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
@lujiajing1126
lujiajing1126 / parser.ts
Created December 20, 2021 10:12
promql parser
import { pipe } from 'fp-ts/lib/function';
import { string as S, parser as P, char as C } from 'parser-ts';
import {
Matcher,
MatchType,
VectorSelector,
MatrixSelector,
Expr,
BinaryOp,
BinaryExpr,
@lujiajing1126
lujiajing1126 / main.py
Last active June 9, 2019 12:15
Sample for using BHF EOS with python
import numpy as np
import re
import gzip
EOS2_HEADER = "cccccccccccc"
CE = 1.78266E12
M_U = 931.494
# Index for HShen EOS table, V2
@lujiajing1126
lujiajing1126 / doi2bib.sh
Created April 15, 2018 06:55
DOI to BIB
#!/bin/bash
usage() {
echo "doi2bib [doi]"
exit 127
}
[ $# -lt 1 ] && usage
fetchDOI() {
@lujiajing1126
lujiajing1126 / fd-net-auth.go
Created January 25, 2018 14:13
Fudan Network Auth
package main
import (
"io/ioutil"
"flag"
"fmt"
"net/http"
"net/url"
"os"
"crypto/tls"
@lujiajing1126
lujiajing1126 / bit2text.sql
Last active August 31, 2017 07:17
PG Cast Helpers
CREATE OR REPLACE FUNCTION bit2text(BIT VARYING)
RETURNS TEXT
AS $$
SELECT textin(bit_out($1));
$$ LANGUAGE 'sql';
@lujiajing1126
lujiajing1126 / use-proxy
Last active March 15, 2017 17:03
let your command line program surf via proxy by adding one letter
#!/bin/bash
# you can set alias p="use-proxy" in your .bashrc or .zshrc
# then you can type: p curl https://google.com
set -e
usage () {
echo "use-proxy [-u] <command>"
exit 127
}
@lujiajing1126
lujiajing1126 / .bash_colors
Last active August 2, 2016 05:47
RPC caller
#!/bin/bash
#
# Constants and functions for terminal colors.
# Author: Max Tsepkov <max@yogi.pw>
CLR_ESC="\033["
# All these variables has a function with the same name, but in lower case.
#
CLR_RESET=0 # reset all attributes to their defaults

Keybase proof

I hereby claim:

  • I am lujiajing1126 on github.
  • I am megrez (https://keybase.io/megrez) on keybase.
  • I have a public key ASCk7zuGy8AWyc4N6kZpf-8dwQv054o0OlnmKyaDt7Tv5wo

To claim this, I am signing this object:

@lujiajing1126
lujiajing1126 / SQLBuilder.js
Created June 9, 2015 16:11
A Raw Nodejs SQL Builder(Raw Version)
var util = require('util');
var utils = require('./utils');
var _ = require('underscore');
var crypto = require('crypto');
function SQLBuilder() {
this.reset();
}
SQLBuilder.prototype.reset = function () {