Skip to content

Instantly share code, notes, and snippets.

View timercrack's full-sized avatar

JeffChen timercrack

View GitHub Profile

Setup ExpressVPN in OpenVPN on OpenWrt

These instructions will get ExpressVPN up & running in OpenVPN on OpenWrt.

opkg update
opkg install -force-overwrite openvpn-openssl luci-app-openvpn

Log back into Luci & there will now be a menu VPN > OpenVPN.

@unixfox
unixfox / readme.md
Last active May 20, 2024 21:02
How to get IPv4 connectivity on an IPv6 only VPS

Some hosting providers like scaleway allows to remove the IPv4 from the VPS in order to save 1€/month but doing this will result in losing connectivity to the "IPv4 world".
Or you may have ordered a VPS that only has IPv6 connectivity and you want to access to a resource only accessible from the "IPv4 world".
Here is how to gain your access back to the "IPv4 world".

Change your name servers(s) to DNS64 name servers(s)

Note: You may deploy your own DNS64 & NAT64 server on a separate server by following this tutorial (untested): https://packetpushers.net/nat64-setup-using-tayga/.
Note²: You may find a explanation of what is NAT64 and DNS64 on Wikipedia.

  1. Choose a/multiple DNS64 public server(s) that has/have its own NAT64 public service from this list:
@jimmychu0807
jimmychu0807 / string-conversion.rs
Created November 21, 2019 10:20
Conversion between String, str, Vec<u8>, Vec<char> in Rust
use std::str;
fn main() {
// -- FROM: vec of chars --
let src1: Vec<char> = vec!['j','{','"','i','m','m','y','"','}'];
// to String
let string1: String = src1.iter().collect::<String>();
// to str
let str1: &str = &src1.iter().collect::<String>();
// to vec of byte
@timercrack
timercrack / holiday.py
Created August 16, 2016 09:41
获取近5年的法定节假日和休息日,使用百度公共API
import datetime
import aiohttp
import asyncio
import tqdm
type_name = ['工作日', '休息日', '节假日']
max_conn = asyncio.Semaphore(15) # 最大并发连接数, 默认15
async def fetch(url, day):
await max_conn.acquire()
@timercrack
timercrack / checksum.py
Created January 20, 2016 07:39
python construct checksum fields made easy for common tasks
#!/usr/bin/env python
# from https://groups.google.com/forum/#!topic/construct3/FzYFmdv4qTg
from construct import *
# copied from core.py
def _read_stream(stream, length):
if length < 0:
raise ValueError("length must be >= 0", length)
data = stream.read(length)
@sr75
sr75 / osx-homebrew-setup.md
Last active June 18, 2020 06:35
Mac Yosemite OSX - Homebrew (RVM/MySQL/Redis) setup

Mac Homebrew (RVM/MySQL/Redis) setup

Follow the steps below to setup a local development environment:

XQuartz

Recommended to download latest XQuartz

iTerm2

@href
href / dict_namedtuple.py
Created October 27, 2011 12:00
Convert any dictionary to a named tuple
from collections import namedtuple
def convert(dictionary):
return namedtuple('GenericDict', dictionary.keys())(**dictionary)
"""
>>> d = dictionary(a=1, b='b', c=[3])
>>> named = convert(d)
>>> named.a == d.a
True
>>> named.b == d.b