Skip to content

Instantly share code, notes, and snippets.

View kyouheicf's full-sized avatar
🍊

kyouheicf

🍊
  • 03:27 (UTC +09:00)
View GitHub Profile
#!/bin/bash
brew install --cask cloudflare-warp
#!/bin/bash
cat <<EOF >> ~/.zshrc
alias myip4='dig +short @1.1.1.1 whoami.cloudflare ch txt | sed "s/\"//g"'
alias myip6='dig +short @2606:4700:4700::1111 -6 ch txt whoami.cloudflare | sed "s/\"//g"'
EOF
source ~/.zshrc
sudo killall -HUP mDNSResponder
sudo killall mDNSResponderHelper
sudo dscacheutil -flushcache
@kyouheicf
kyouheicf / Return_small_HTML_page.js
Last active September 15, 2021 03:42
comment is added to code example
// https://developers.cloudflare.com/workers/examples/return-html
// The value of const can't be changed through reassignment
// Template literals allow us to define multiple lines using ``
const html = `<!DOCTYPE html>
<body>
<h1>Hello World</h1>
<p>This markup was generated by a Cloudflare Worker.</p>
</body>`
@kyouheicf
kyouheicf / list_cf_api_endpoint.py
Last active November 9, 2021 15:42
This script is intended to be used in order to add extra api call to python-cloudlare. You can do it through "python3 list_cf_api_endpoint.py >> ~/.cloudflare/cloudflare.cfg".
# Import Library
from bs4 import BeautifulSoup
import urllib.request
# Set URL
url = "https://api.cloudflare.com/"
# Retrieve from URL
html = urllib.request.urlopen(url)
# Use BeautifulSoup
soup = BeautifulSoup(html, "html.parser")
export EMAIL='YOUR_EMAIL'
export APIKEY='YOUR_APIKEY'
export ACCOUNT_ID='YOUR_ACCOUNT_ID'
export ZONE_NAME='example.com'
curl -sX POST "https://api.cloudflare.com/client/v4/zones" \
-H "X-Auth-Email: $EMAIL" \
-H "X-Auth-Key: $APIKEY" \
-H "Content-Type: application/json" \
--data '{"name":"'"$ZONE_NAME"'","account":{"id":"'"$ACCOUNT_ID"'"},"jump_start":false,"type":"partial"}' | jq
/client/v4/accounts
/client/v4/accounts/:account_id/gateway/categories
/client/v4/accounts/:account_id/rulesets
/client/v4/accounts/:account_id/rulesets/:ruleset_id
/client/v4/accounts/:account_id/rulesets/:ruleset_id/rules
/client/v4/accounts/:account_id/rulesets/:ruleset_id/rules/:rule_id
/client/v4/accounts/:account_id/rulesets/:ruleset_id/versions
/client/v4/accounts/:account_id/rulesets/:ruleset_id/versions/:ruleset_version
/client/v4/accounts/:account_id/rulesets/phases/:ruleset_phase/entrypoint
/client/v4/accounts/:account_identifier/addressing/loa_documents
npm install wrangler --save-dev && wrangler --version
git init && gh repo create --source $(git rev-parse --show-toplevel) --public
git add -A && git commit -m 'initial commit' && git push -u origin main
gh repo edit --add-topic cloudflare,cloudflare-workers
npm config set cafile ~/.npm/Cloudflare_CA.pem
// To disable the config above...
// npm config delete cafile
// or
// npm config delete cafile --location=global