Skip to content

Instantly share code, notes, and snippets.

@rinex20
rinex20 / snat_dnat_advantech.md
Created December 18, 2023 02:06 — forked from tomasinouk/snat_dnat_advantech.md
examples of SNAT, DNAT with iptables for Advantech, Conel routers, with comments (probably will work on other routers where iptables can be manipulated, care needs to be taken on applying these commands after reboot).

Some examples of SNAT, DNAT with iptables with comments

mainly used in start-up script

How to test 'safely'

When we play with iptables aka firewall we might end up in situation, where we execute rule, which has unforseen impact - lock yourself out. Recovering from this situation is necessity.

How to:

  • Enable reboot via SMS.
  • Test all commands in shell first before putting them into Start-up script. This way the command will be wiped out, when unit is rebooted.

masquarade all outgoing packets to be WLAN0 IP

@rinex20
rinex20 / gcc compiler optimization for arm systems.md
Created November 3, 2023 02:05 — forked from fm4dd/gcc compiler optimization for arm systems.md
GCC compiler optimization for ARM-based systems

GCC compiler optimization for ARM-based systems

2017-03-03 fm4dd

The gcc compiler can optimize code by taking advantage of CPU specific features. Especially for ARM CPU's, this can have impact on application performance. ARM CPU's, even under the same architecture, could be implemented with different versions of floating point units (FPU). Utilizing full FPU potential improves performance of heavier operating systems such as full Linux distributions.

-mcpu, -march: Defining the CPU type and architecture

These flags can both be used to set the CPU type. Setting one or the other is sufficient.

@rinex20
rinex20 / Synology-Diskstation-Git.md
Created October 22, 2023 05:39 — forked from walkerjeffd/Synology-Diskstation-Git.md
Instructions for setting up git server on Synology Diskstation

Configure Synology NAS as Git Server

Instructions for setting up a git server on a Synology NAS with Diskstation. Specifically, I am using a DS414 with DSM 5.0.

Set Up User and Folder

  • Create user gituser via Diskstation interface (with File Station and WebDAV privilages)
  • Add new shared folder called git (located at /volume1/git) with read/write access for gituser and admin. This folder will hold all the repos.
  • Install Git Server package via Diskstation
@rinex20
rinex20 / gost-tun-tap-guide.md
Last active May 17, 2022 15:27
Gost应用--Tun/Tap篇

GOST tun/tap 应用指南

准备工作

  1. 需要有一台VPS作为服务端,Linux发行版都可以,没特别要求,但是要确认支持tun/tap驱动,至于如何确认,后面会讲到。
  2. Windows和Linux/Mac上都可以运行客户端。其中tap模式,不支持Mac。

工作原理

以tun模式为例。 服务端运行后,创建P2P的tun网卡,IP为10.168.10.1.

@rinex20
rinex20 / gost_install.sh
Last active May 14, 2022 04:43
gost installer for network
#!/bin/bash
# https://raw.githubusercontent.com/sunpma/doubi/master/iptables-pf.sh 一键转发
# sudo curl -o install.sh http://192.168.90.227/gost/install.sh | sudo bash install.sh
set -ex
mkdir -p /etc/gost && \
cd /etc/gost
@rinex20
rinex20 / a-v2ray-client-frp.md
Last active April 27, 2022 08:13
## v2ray config json file for intranet proxy

v2ray config json file for intranet proxy

[Unit]
Description=iPerf3
After=network.target
[Service]
Type=simple
User=nobody
Restart=on-failure
ExecStart=/usr/bin/iperf3 -s
@rinex20
rinex20 / ss-redir 透明代理.md
Created December 30, 2016 08:53 — forked from wen-long/ss-redir 透明代理.md
ss-redir 透明代理.md

##ss-redir 的 iptables 配置(透明代理)

透明代理指对客户端透明,客户端不需要进行任何设置就使用了网管设置的代理规则

创建 /etc/ss-redir.json 本地监听 7777 运行ss-redir -v -c /etc/ss-redir.json

iptables -t nat -N SHADOWSOCKS
# 在 nat 表中创建新链
iptables -t nat -A SHADOWSOCKS -p tcp --dport 23596 -j RETURN
# 23596 是 ss 代理服务器的端口,即远程 shadowsocks 服务器提供服务的端口,如果你有多个 ip 可用,但端口一致,就设置这个
@rinex20
rinex20 / gist:8026a9d3b6736af50582
Created February 17, 2016 13:49 — forked from anonymous/gist:8b4a0101f5101f756bb9
Get OAUTH2.0 access token for Google Voice with a shell-script
#!/bin/bash
##
## Authenticate with Google Voice
##
USAGE="`basename $0` {auth|refresh|token} ctx"
CTX_DIR=$HOME/.gvauth
CLIENT_ID="YOUR_CLIENTID_FROM_GOOGLE_DEVELOPER_CONSOLE"
CLIENT_SECRET="YOUR_CLIENTSECRET_FROM_GOOGLE_DEVELOPER_CONSOLE"
SCOPE="https://www.googleapis.com/auth/googletalk%20https://www.googleapis.com/auth/userinfo.email%20https://www.googleapis.com/auth/userinfo.profile"
@rinex20
rinex20 / usbreset.c
Created February 14, 2016 14:49 — forked from x2q/usbreset.c
usbreset used for 3G dongle
/* usbreset -- send a USB port reset to a USB device
*
* Compile using: gcc -o usbreset usbreset.c
*
*
* */