Skip to content

Instantly share code, notes, and snippets.

View centminmod's full-sized avatar

George Liu (eva2000) centminmod

View GitHub Profile
@bagder
bagder / h3-server-howto.md
Last active March 10, 2024 21:13
Setup an HTTP/3 test server

Setup a local HTTP/3 test server

... to toy with and run curl against it.

This is not advice on how to run anything in production. This is for development and experimenting.

Preqreqs

An existing local HTTP/1.1 server that hosts files. Preferably also a few huge ones.

@Nooshu
Nooshu / workre.js
Created February 20, 2021 23:35
Cloudflare Worker code used when modifying the priority hints for the Nike UK homepage.
// set the site we are modifying
const site = 'www.nike.com';
// do this on a fetch
addEventListener('fetch', event => {
const request = event.request
const url = new URL(request.url)
event.respondWith(handleRequest(request))
});
@troyhunt
troyhunt / rick-roll-content-scraper.js
Created August 19, 2020 07:41
A Cloudflare worker to redirect image requests from dickhead content scraper's site to a Rick Roll
addEventListener('fetch', event => {
event.respondWith(fetchAndApply(event.request))
})
async function fetchAndApply(request) {
let response = await fetch(request)
let referer = request.headers.get('Referer')
let contentType = response.headers.get('Content-Type') || ''
if (referer && contentType.startsWith('image/')) {
@DerekHawkins
DerekHawkins / core_web_vitals_analysis_example.py
Created June 1, 2020 13:47
core_web_vitals_analysis_example.py
import pandas as pd
import requests
import urllib
import time
import re
# Data Visualization
from plotly import tools
import chart_studio
@rolisz
rolisz / Cargo.toml
Last active May 24, 2023 09:48
Simple web crawler in Rust
[package]
name = "rust_crawler"
version = "0.1.0"
authors = ["Roland Szabo <rolisz@gmail.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
reqwest = { version = "0.10", features = ["json", "blocking"] }
@sperand-io
sperand-io / worker.js
Last active October 28, 2023 09:41
Cloudflare Workers / Segment Smart Proxy — serve data collection assets and endpoints from your own domain
/**
* Steps to use:
* 1. Create CF Worker, copy and paste this in
* 2. (Optional) Update configuration defaults
* - If you want to manage in code, do so below under "Static Configuration"
* - If you want dynamic custom config: Create CFW KV namespace, link them, and add reference below
*
* - You can overwrite default path prefix for loading analytics.js (<yourdomain>/ajs)
* (corresponding KV entry: `script_path_prefix`)
* - You can overwrite default path prefix for handling first-party data collection (<yourdomain>/data)

CrUX.now() (bit.ly/crux-now)

(10min demo at the performance.now() meetup, 20 November 2019, Amsterdam)

CrUX is the Chrome User Experience Report, a public dataset of performance and UX data from real Chrome users in the field.

Quick facts:

  • Launched in November 2017
  • Monthly data dumps (second Tuesday)
@runlevel5
runlevel5 / nginx_njs_environment_variables.md
Last active February 28, 2024 09:17
Using njs to fetch environment variables

There are many ways to parse in variable into the nginx config file. Some uses set_by_lua which is offered by lua-nginx-module. Some use envstubst to populate varilabes into a template file.

Today I am going to show you how to do that with njs the JS scripting engine for nginx.

## /etc/nginx/fetch_env.js
function fetch_upstream_host(r) {
 return process.env.UPSTREAM_HOST;
I have done some preliminary research into this bug and so far it does not seem like a backdoor. Just some really weird logic when handling routes, and rendering templates.
As to why widgetConfig[code] executes via a POST request, it is because of the following code located in /includes/vb5/frontend/applicationlight.php
$serverData = array_merge($_GET, $_POST);
if (!empty($this->application['handler']) AND method_exists($this, $this->application['handler']))
{
$app = $this->application['handler'];
@fevangelou
fevangelou / install_nano_on_macos_without_homebrew.sh
Last active January 3, 2024 14:43
Install Nano Editor (with syntax highlighting) on MacOS without using Homebrew [updated Jan 2024]
#!/bin/bash
# Install Nano Editor (with syntax highlighting) on MacOS without using Homebrew
# You can get the latest version number from https://www.nano-editor.org
# Instructions:
# - First off, download this Bash script from the browser & make it executable:
# $ chmod +x install_nano_on_macos_without_homebrew.sh
# - If you have "wget" installed (you most likely do), just run the script with:
# $ ./install_nano_on_macos_without_homebrew.sh