Skip to content

Instantly share code, notes, and snippets.

View spacewander's full-sized avatar
🏢
working

罗泽轩 spacewander

🏢
working
View GitHub Profile
@spacewander
spacewander / x.diff
Last active January 26, 2024 15:15
Envoy on demand copy headers vs copy headers
diff --git a/contrib/golang/common/dso/dso.cc b/contrib/golang/common/dso/dso.cc
index ee8b0abda4..8cfb641c91 100644
--- a/contrib/golang/common/dso/dso.cc
+++ b/contrib/golang/common/dso/dso.cc
@@ -93,9 +93,9 @@ GoUint64 HttpFilterDsoImpl::envoyGoFilterOnHttpData(httpRequest* p0, GoUint64 p1
return envoy_go_filter_on_http_data_(p0, p1, p2, p3);
}
-void HttpFilterDsoImpl::envoyGoFilterOnHttpLog(httpRequest* p0, int p1) {
+void HttpFilterDsoImpl::envoyGoFilterOnHttpLog(httpRequest* p0, int p1, GoUint64 p2, GoUint64 p3) {
@spacewander
spacewander / output
Created June 19, 2022 16:08
Can we hide real filename due to https://t.co/LMiYsdIltI?
type: application/x-stuff
filename: This is ***fun***
type: application/x-stuff
filename: a
@spacewander
spacewander / fault-injection.ts
Created November 16, 2021 06:36
WASM plugin for apisix
export * from "@solo-io/proxy-runtime/proxy"; // this exports the required functions for the proxy to interact with us.
import {
RootContext, Context, registerRootContext, log,
LogLevelValues, FilterHeadersStatusValues,
FilterTrailersStatusValues, GrpcStatusValues,
send_local_response
} from "@solo-io/proxy-runtime";
class FaultInjection extends RootContext {
@spacewander
spacewander / fault-injection.rs
Last active September 2, 2022 06:14
WASM plugin for apisix
use log::*;
use rand::Rng;
use serde::{Deserialize, Serialize};
use proxy_wasm::traits::*;
use proxy_wasm::types::*;
#[no_mangle]
pub fn _start() {
proxy_wasm::set_log_level(LogLevel::Info);
proxy_wasm::set_root_context(|_| -> Box<dyn RootContext> {
@spacewander
spacewander / run.sh
Created July 27, 2020 02:37
kafka Mirror Maker configure for SASL PLAIN user/password authenciation
./kafka-run-class.sh kafka.tools.MirrorMaker \
--consumer.config ../config/source.consumer.configure \
--producer.config ../config/target.producer.configure \
--num.streams 4 \
--new.consumer \
--whitelist=xxx
@spacewander
spacewander / a.sql
Created May 15, 2018 03:15
my pgsql collection
-- drop all table in a database
select string_agg('drop table "' || tablename || '" cascade', ';') from pg_tables where schemaname = 'public';
-- copy the ouput and execute it
@spacewander
spacewander / install-rock-scm-0.sh
Created April 6, 2018 15:06
install luarocks scm-0 version
#!/usr/bin/env bash
# luarocks install $1 scm-0 doesn't work, but you could run this instead:
wget https://luarocks.org/$1-scm-0.rockspec && sudo luarocks build $1-scm-0.rockspec
@spacewander
spacewander / release_info.rb
Last active June 22, 2020 03:11
git-extras release script
#!/usr/bin/env ruby
# encoding: UTF-8
require 'set'
# usage: $SCRIPT <dir_of_git_extras>
Dir.chdir ARGV[0]
puts <<EOS
The git-extras $version ($release-name) is released now!
Here's a list of all the changes made in this release; the full changelog can be found in [History.md](https://github.com/tj/git-extras/blob/master/History.md):
@spacewander
spacewander / Murmur2A
Last active November 21, 2017 08:21
SMHasher result for md5_32a Murmur3A Murmur3F and more...
-------------------------------------------------------------------------------
--- Testing Murmur2A (MurmurHash2A for x86, 32-bit)
[[[ Sanity Tests ]]]
Verification value 0x7FBD4396 : Passed!
Running sanity check 1..........PASS
Running sanity check 2..........PASS
[[[ Speed Tests ]]]
@spacewander
spacewander / list_dependencies.py
Created January 4, 2017 11:04
Quick and dirty script for git-extras
#!/usr/bin/env python
# coding: utf-8
"""
Run this quick-and-dirty script to list dependencies used in git-extras/bin.
With -t option, print result with markdown table syntax.
With -v option, grep usage to filter out false positive result.
"""
from collections import defaultdict
import os
import re