Skip to content

Instantly share code, notes, and snippets.

View lzcykevin's full-sized avatar

Frank lzcykevin

  • CW
View GitHub Profile
@lzcykevin
lzcykevin / failover.sh
Created December 2, 2022 04:46 — forked from Apsu/failover.sh
An example failover script for dual WAN, using a ping healthcheck and managing default routes appropriately
#!/bin/bash
# Set defaults if not provided by environment
CHECK_DELAY=${CHECK_DELAY:-5}
CHECK_IP=${CHECK_IP:-8.8.8.8}
PRIMARY_IF=${PRIMARY_IF:-eth0}
PRIMARY_GW=${PRIMARY_GW:-1.2.3.4}
BACKUP_IF=${BACKUP_IF:-eth1}
BACKUP_GW=${BACKUP_GW:-2.3.4.5}
@xiaopc
xiaopc / gaWorker.js
Last active October 25, 2023 14:50
Google Analytics 4 Proxy with Cloudflare Workers
// 2023.4.23 更新,修复 gtag.js 加了个回车导致失效的问题
// 2023.3.2 更新,修复上报到 region*.google-analytics.com 未被代理的问题
addEventListener('fetch', (event) => {
// 这里可以加 filter
return event.respondWith(handleRequest(event));
});
// worker 应用的路由地址,末尾不加 '/'
const DOMAIN = 'https://example.workers.dev/routerpath';
@asuna
asuna / cloudflare_update.script
Last active February 22, 2024 05:27 — forked from viritt/cloudflare_update.script
Automatic script for Mikrotik RouterOS updating record on CloudFlare.
#########################################################################
# ================================================== #
# $ Mikrotik RouterOS update script for CloudFlare $ #
# ================================================== #
# #
# - You need a CloudFlare account & api key (look under settings), #
# a zone and A record in it #
# - All variables in first section are obvious, except CFid, #
# To obtain CFzoneid use following command in any unix shell: #
# curl -X GET "https://api.cloudflare.com/client/v4/zones" -H "X-Auth-Email: YOUR_EMAIL" -H "X-Auth-Key: YOUR_API_KEY" -H "Content-Type: application/json" | python -mjson.tool
@viritt
viritt / cloudflare_update.script
Last active December 26, 2023 16:14 — forked from kiler129/cloudflare_update.script
Automatic script for Mikrotik RouterOS updating record on CloudFlare.
#########################################################################
# ================================================== #
# $ Mikrotik RouterOS update script for CloudFlare $ #
# ================================================== #
# #
# - You need a CloudFlare account & api key (look under settings), #
# a zone and A record in it #
# - All variables in first section are obvious, except CFid, #
# To obtain CFzoneid use following command in any unix shell: #
# curl -X GET "https://api.cloudflare.com/client/v4/accounts" -H "X-Auth-Email: YOUR_EMAIL" -H "X-Auth-Key: YOUR_API_KEY" -H "Content-Type: application/json" | python -mjson.tool
@rlex
rlex / gist:2ec8562c4642032600e3e4c8a5acac4b
Created April 4, 2018 13:42
Mikrotik <-> Linux GRE/IPSec, strongswan
config setup
charondebug="ike 2, knl 2, cfg 2, net 2, esp 2, dmn 2, mgr 2"
conn %default
# keyexchange=ikev2
conn mikrotik-1
# Try connect on daemon start
auto=start
@parmentf
parmentf / GitCommitEmoji.md
Last active April 26, 2024 09:53
Git Commit message Emoji
# -*- coding: utf-8 -*-
# 14-8-20
# create by: snower
import os
import time
import multiprocessing
from logging.handlers import RotatingFileHandler, TimedRotatingFileHandler
class RotatingFileHandler(RotatingFileHandler):
@samhernandez
samhernandez / mysqlsync
Last active March 22, 2024 16:14
Sync remote mysql database to local over ssh
#!/bin/bash
# This script assumes you have ssh access to a remote server
# Both databases are backed up to sql files in the same directory
# this script is executed from.
# Usage:
# 1. Make sure this file is executable with `chmod +x mysqlsync`
# 2. Set the credentials for the variables at the top
# (Remember, no spaces around the '=' sign)
# 3. Run it from a directory where you'd like the backup files to go:
@rxaviers
rxaviers / gist:7360908
Last active April 26, 2024 06:50
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@Apsu
Apsu / failover.sh
Last active February 12, 2024 07:08
An example failover script for dual WAN, using a ping healthcheck and managing default routes appropriately
#!/bin/bash
# Set defaults if not provided by environment
CHECK_DELAY=${CHECK_DELAY:-5}
CHECK_IP=${CHECK_IP:-8.8.8.8}
PRIMARY_IF=${PRIMARY_IF:-eth0}
PRIMARY_GW=${PRIMARY_GW:-1.2.3.4}
BACKUP_IF=${BACKUP_IF:-eth1}
BACKUP_GW=${BACKUP_GW:-2.3.4.5}