Skip to content

Instantly share code, notes, and snippets.

<!-- <!DOCTYPE html> Required -->
<!DOCTYPE html>
<html lang="en">
<head>
<!-- <title> Required -->
<title>Error Page</title>
<!-- The HTML file must contain at least 100 characters. An easy way to do that is to add the universal normalize.css snippet -->
<style>
/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;
# Cache API Docs + Example
- https://developers.cloudflare.com/workers/about/using-cache/
- https://developers.cloudflare.com/workers/reference/apis/cache
```js
addEventListener('fetch', event => {
event.respondWith(handleRequest(event))
})
async function handleRequest(request) {
@shagamemnon
shagamemnon / waf-disable-to-simulate.md
Last active March 3, 2021 20:24
Change all rules from Cloudflare Managed Rulesets to simulate mode
## Sample / prototype Worker snippet for bot management + KV + rate limiting
### Requires:
* Wrangler (https://github.com/cloudflare/wrangler)
* API key with Workers, and Workers KV write Permissions
```js
const CIDR = require('cidr-js')
const cidr = new CIDR()
/*
@shagamemnon
shagamemnon / cloudflared-system-service-linux.md
Created July 16, 2021 05:38
cloudflared system service on AWS Linux

Configure .cloudflared to run on boot as system service

ssh -i "/path/to/cert.pem" ec2-user@ec2-100-25-159-112.compute-1.amazonaws.com
# ...

# Traverse file directory to ~/.cloudflared
cd ~/.cloudflared
# Elevate to root permission
sudo su
# Temporarily append ec2-user PATH to root user path for duration of terminal session
@shagamemnon
shagamemnon / wsl2-network.ps1
Created February 10, 2023 16:46 — forked from xmeng1/wsl2-network.ps1
WSL2 Port forwarding port to linux
$remoteport = bash.exe -c "ifconfig eth0 | grep 'inet '"
$found = $remoteport -match '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}';
if( $found ){
$remoteport = $matches[0];
} else{
echo "The Script Exited, the ip address of WSL 2 cannot be found";
exit;
}