Skip to content

Instantly share code, notes, and snippets.

@nitred
nitred / optimal_mtu.md
Last active July 16, 2024 11:51
Wireguard Optimal MTU

About

  • I faced bandwidth issues between a WG Peer and a WG server. Download bandwidth when downloading from WG Server to WG peer was reduced significantly and upload bandwidth was practically non existent.
  • I found a few reddit posts that said that we need to choose the right MTU. So I wrote a script to find an optimal MTU.
  • Ideally I would have liked to have run all possible MTU configurations for both WG Server and WG Peer but for simplicity I choose to fix the WG Server to the original 1420 MTU and tried all MTUs from 1280 to 1500 for the WG Peer.

Testing

  • On WG server, I started an iperf3 server
  • On WG peer, I wrote a script that does the following:
    • wg-quick down wg0
  • Edit MTU in the /etc/wireguard/wg0.conf file
@dockerlead
dockerlead / Tutorial.md
Created November 16, 2020 05:04
Wireguard on CentOS 7/8

Set Up Your Own WireGuard VPN Server on CentOS

This tutorial is going to show you how to set up your own WireGuard VPN server on CentOS. WireGuard is made specifically for the Linux kernel. It runs inside the Linux kernel and allows you to create fast, modern, and secure VPN tunnel. TL;DR

Prerequisites

This tutorial assumes that the VPN server and VPN client are both running CentOS operating system.

Step 1: Install WireGuard on CentOS Server and Desktop

Log into your CentOS server, then run the following commands to install WireGuard.

# CentOS 8
@evangwt
evangwt / timestamp.go
Last active January 19, 2021 06:22
xorm timestamp
package common
import (
"fmt"
"time"
)
// Timestamp 自定义时间戳类型,支持Mysql的TIMESTAMP,DATETIME,DATE类型
type Timestamp int64
@tanpengsccd
tanpengsccd / config.json
Last active April 30, 2024 06:12
v2ray服务端 json 配置 文件
{
"log": {
"access": "/var/log/v2ray/access.log",
"error": "/var/log/v2ray/error.log",
"loglevel": "warning"
},
"inbound": { //理论最安全的方式 ws,有条件加上TLS
"port": 20080, //开启的端口,建议实用caddy加上TLS加密
"protocol": "vmess",

PySpark UDF improvements proposal

UDF creation

Current state

Right now there are a few ways we can create UDF:

  • With standalone function:
@sosedoff
sosedoff / 1_simple.go
Created July 16, 2016 18:45
Golang Custom Struct Tags Example
package main
import (
"fmt"
"reflect"
)
// Name of the struct tag used in examples
const tagName = "validate"
@darcyliu
darcyliu / install_spark_centos7.sh
Created April 1, 2016 09:40
Install Spark on CentOS 7
#!/bin/bash
# Install Spark on CentOS 7
yum install java -y
java -version
yum install wget -y
wget http://downloads.typesafe.com/scala/2.11.7/scala-2.11.7.tgz
tar xvf scala-2.11.7.tgz
sudo mv scala-2.11.7 /usr/lib
sudo ln -s /usr/lib/scala-2.11.7 /usr/lib/scala
@maxwellito
maxwellito / m3u8-concat.sh
Created December 28, 2015 22:05
Concat / join .ts segment files into an mp4 file
#!/bin/sh
# This script must be executed in the repo where
# the *.ts files are.
# It will concatenate the segments into one temp
# file which ffmpeg will reencode the audio track.
# By default the ouptup filename is output.mp4
# but can be changed by providing the name as parameter.
#
# ffmpeg is required
@jinuljt
jinuljt / securepost.go
Last active December 3, 2020 03:28
微信退款接口使用商户证书请求golang实现
import (
"bytes"
"crypto/tls"
"crypto/x509"
"io/ioutil"
"net/http"
)
wechatCertPath = "/path/to/wechat/cert.pem"
wechatKeyPath = "/path/to/wechat/key.pem"
@apokalyptik
apokalyptik / decrypt.go
Created September 1, 2014 22:36
Go RSA private key decryption example. Compatible with data encrypted via http://us3.php.net/openssl_public_encrypt
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"encoding/pem"
"flag"
"fmt"
"io/ioutil"