Skip to content

Instantly share code, notes, and snippets.

View nirui's full-sized avatar
Slow to respond

R+ nirui

Slow to respond
View GitHub Profile
#!/bin/bash
# DEFAULT
iptables -P INPUT DROP
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
iptables -A INPUT -p tcp --dport 30001 -j ACCEPT
<?xml version="1.0" encoding="utf-8"?>
<direct>
<chain table="filter" ipv="ipv4" chain="proxy_restriction"/>
<chain table="nat" ipv="ipv4" chain="proxy_redirect"/>
<rule priority="1" table="filter" ipv="ipv4" chain="proxy_restriction">-p tcp --sport 2302 -j RETURN</rule>
<rule priority="1" table="filter" ipv="ipv4" chain="proxy_restriction">-p udp --sport 2302 -j RETURN</rule>
<rule priority="1" table="filter" ipv="ipv4" chain="proxy_restriction">-p tcp --dport 3128 -j RETURN</rule>
<rule priority="1" table="filter" ipv="ipv4" chain="proxy_restriction">-p tcp --dport 8080 -j RETURN</rule>
struct Test {
n: usize,
}
struct Test2<'a> {
n_borrow: &'a usize,
}
impl Test {
pub fn return_n(&self) -> Test2 {
package main
import (
"fmt"
"time"
)
type s struct {
s []*s
}
package main
import (
"fmt"
"time"
)
type s struct {
s []sData
}
package main
import (
"fmt"
"time"
)
type s struct {
s []sData
}
package main
import (
"crypto/rand"
"testing"
)
var sample = makeSample()
const sampleSize = 4096
package main
import (
"testing"
"time"
)
func BenchmarkTimeNow(b *testing.B) {
for i := 0; i < b.N; i++ {
time.Now()
#!/bin/bash
TEST_TARGET=$1
RECOVER_COMMANDS=("${@:2}")
while true; do
for RECOVER_CMD in "${RECOVER_COMMANDS[@]}"; do
while true; do
sleep 1
@nirui
nirui / To Deploy A Proxy.md
Last active July 14, 2022 06:48
To deploy a proxy

To deploy a proxy

Copyright (C) 2020 RUI Ni (ranqus@gmail.com)

This is a document on how to depoly a reasonably secured proxy server which is capable of relaying non-critical communications and few other tasks.

Given the fact that this document is largely a personal note and memo, information and method provided in this document may NOT be useful for your use case. Do NOT follow the content if you don't fully understand the information and instruction.

The document also assumes the reader has decent amont of knownledge about Linux server. Because of that, step-by-step guide will not be provided, the reader must install and fine tune the softwares by themselves.