Skip to content

Instantly share code, notes, and snippets.

View iamspark1e's full-sized avatar
🎶
The Real Folk Blues

Wenbo iamspark1e

🎶
The Real Folk Blues
View GitHub Profile
@iamspark1e
iamspark1e / cf-worker-utils.js
Last active August 2, 2021 09:15
Some useful functions which can be used in Cloudflare Worker.
export function getCountryCode(request) { return request.headers.get('CF-IPCountry'); }
/**
* Continent-Country code mapping
* "Attention: Source data from link below, under John Snow Labs Standard License"
* @link https://datahub.io/JohnSnowLabs/country-and-continent-codes-list
* @param {string} countryCode 2 unit Country Code
* @returns Continent Code
*/
export function CountryCode2Continent(countryCode) {
const mapping = {"AF":"AS","AL":"EU","AQ":"AN","DZ":"AF","AS":"OC","AD":"EU","AO":"AF","AG":"NA","AZ":"AS","AR":"SA","AU":"OC","AT":"EU","BS":"NA","BH":"AS","BD":"AS","AM":"AS","BB":"NA","BE":"EU","BM":"NA","BT":"AS","BO":"SA","BA":"EU","BW":"AF","BV":"AN","BR":"SA","BZ":"NA","IO":"AS","SB":"OC","VG":"NA","BN":"AS","BG":"EU","MM":"AS","BI":"AF","BY":"EU","KH":"AS","CM":"AF","CA":"NA","CV":"AF","KY":"NA","CF":"AF","LK":"AS","TD":"AF","CL":"SA","CN":"AS","TW":"AS","CX":"AS","CC":"AS","CO":"SA","KM":"AF","YT":"AF","CG":"AF","CD":"AF","CK":"OC","CR":"NA","HR":"EU","CU":"NA","CY":"AS","CZ":"EU","BJ"
const express = require('express'); // Adding Express
const app = express(); // Initializing Express
const puppeteer = require('puppeteer'); // Adding Puppeteer, Run `apt-get install chromium` first (on Debian)
// Wrapping the Puppeteer browser logic in a GET request
app.get('/', function (req, res) {
// Launching the Puppeteer controlled headless browser and navigate to the Digimon website
puppeteer.launch({
headless: true,

Shadowsocks-libev Docker Image

[shadowsocks-libev][1] is a lightweight secured socks5 proxy for embedded devices and low end boxes. It is a port of [shadowsocks][2] created by @clowwindy maintained by @madeye and @linusyang.

Docker images are built for quick deployment in various computing cloud providers. For more information on docker and containerization technologies, refer to [official document][9].

Prepare the host

*.netflix.com,
*.netflix.net,
*.nflxext.com,
*.nflximg.com,
*.nflximg.net,
*.nflxso.net,
*.nflxvideo.net
@iamspark1e
iamspark1e / another-apt-command.sh
Created November 26, 2021 17:47
InRelease' changed its 'Suite' value from 'testing' to 'stable'
apt-get --allow-releaseinfo-change update
@iamspark1e
iamspark1e / scaleway_s3_cors.md
Created December 28, 2021 17:52
Config CORS of Scaleway S3
  1. Install AWS CLI and config

Link

  1. Put CORS rules in JSON

Link

@iamspark1e
iamspark1e / vzdump.conf
Created December 29, 2021 03:42
Proxmox better backup settings
# vzdump default settings
tmpdir: /tmp
#dumpdir: DIR
#storage: STORAGE_ID
#mode: snapshot|suspend|stop
#bwlimit: KBPS
#ionice: PRI
#lockwait: MINUTES
#stopwait: MINUTES
[nginx-not-found]
# Prevent malicious injection
enabled = true
port = http,https
filter = nginx-not-found
logpath = /var/log/nginx/*.access.log
maxretry = 20
findtime = 60
bantime = 3600
action = iptables[name=HTTP, port=http, protocol=tcp]
dd if=/dev/zero of=1GB.dat bs=1M count=1024
dd if=/dev/zero of=1GB.dat bs=1M count=1024