Skip to content

Instantly share code, notes, and snippets.

@songpp
songpp / regular_expression_engine_comparison.md
Created February 11, 2023 12:21 — forked from CMCDragonkai/regular_expression_engine_comparison.md
Regular Expression Engine Comparison Chart

Regular Expression Engine Comparison Chart

Many different applications claim to support regular expressions. But what does that even mean?

Well there are lots of different regular expression engines, and they all have different feature sets and different time-space efficiencies.

The information here is just copied from: http://regular-expressions.mobi/refflavors.html

@songpp
songpp / two_three_four_tree.rs
Created January 13, 2022 13:59
stupid half 2-3-4 tree
use std::cmp::max;
use std::collections::VecDeque;
use std::convert::TryInto;
use std::fmt::Debug;
use std::mem::MaybeUninit;
use std::ptr::slice_from_raw_parts;
use itertools::Itertools;
use itertools::MinMaxResult;
@songpp
songpp / pg_dump_reader.rs
Last active April 14, 2022 17:52
directory format toc.dat reader
//! this is a pg_dump archive (only 'directory' output) toc.dat reader.
use bytes::{buf::Buf, BytesMut};
use futures_util::stream::StreamExt;
use tokio_util::codec::*;
use nom::{IResult,
number::streaming as ns,
@songpp
songpp / doubly_linked_list.rs
Last active January 2, 2021 16:43
Doubly Linked List in purely safe rust
/// doubly linked list in purely safe rust
use std::rc::{Rc, Weak};
use std::cell::RefCell;
use std::fmt::Debug;
type Node<T> = RefCell<Option<T>>;
#[derive(Debug)]
pub struct ListNode<T> {
@songpp
songpp / gist:5d98773ddb002a216bdc7bf6d7fd2e76
Created July 12, 2020 16:30 — forked from patshaughnessy/gist:70519495343412504686
How to Debug Postgres using LLDB on a Mac
This note explains how to build Postgres from source and setup to debug it using LLDB on a Mac. I used this technique to research this article:
http://patshaughnessy.net/2014/10/13/following-a-select-statement-through-postgres-internals
1. Shut down existing postgres if necessary - you don’t want to mess up your existing DB or work :)
$ ps aux | grep postgres
pat 456 0.0 0.0 2503812 828 ?? Ss Sun10AM 0:11.59 postgres: stats collector process
pat 455 0.0 0.0 2649692 2536 ?? Ss Sun10AM 0:05.00 postgres: autovacuum launcher process
pat 454 0.0 0.0 2640476 304 ?? Ss Sun10AM 0:00.74 postgres: wal writer process
pat 453 0.0 0.0 2640476 336 ?? Ss Sun10AM 0:00.76 postgres: writer process
@songpp
songpp / .ghci
Last active March 21, 2020 13:32
dev .ghci
:set -XGADTs
:set -XOverloadedStrings
import Data.Text (Text)
import qualified Data.Text as T
import qualified Data.Text.Lazy.IO as LT
@songpp
songpp / vs-settings.json
Created March 19, 2020 17:53
vs-settings.json
#
@songpp
songpp / haskell.json
Last active February 24, 2020 05:43
vs haskell snipptes
{
// Place your snippets for haskell here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
// "Print to console": {
// "prefix": "log",
// "body": [
// "console.log('$1');",
@songpp
songpp / gen-stores.sh
Created September 9, 2016 09:48
用于生成开发用的keystore和trust store以及对应的android端用的bks格式的trust store
#!/usr/bin/env bash
# 用于生成开发用的keystore和trust store以及对应的android端用的bks格式的trust store
# 需要 bcprov-ext-jdk15on-1.46.jar 与这个脚本在同一个目录
SCRIPT_DIR=$(cd "$(dirname "$0")"; pwd);
TARGET_DIR="${SCRIPT_DIR}/new_certs"
KEYSTORE="${TARGET_DIR}/keystore.jks"
@songpp
songpp / startup.sh
Created September 9, 2016 09:43
java app startup script template
#!/usr/bin/env bash
# project artifact: ${project.artifact}-${project.version}.jar
# startup script of core
# 需要一个参数: 启动的配置文件名称,这个配置文件必须在当前classpath下
# 启动示例:
# startup.sh 2551.conf 0 0 listening port specified in config file, disable jmx
# startup.sh 2551.conf 3551 listening port is 3551 , disable jmx
# startup.sh my.conf 5555 8555 listening port is 5555, jmx port is 8555
# startup.sh 3551.conf 0 4444 listening port specified in config file, jmx port is 4444