Skip to content

Instantly share code, notes, and snippets.

@thewisenerd
thewisenerd / intercept.py
Created May 22, 2023 17:01
com.azure.azure-cosmos request charge logging
# - run with `mitmdump -s intercept.py -q`
# - clear counters with
# curl -sx localhost:8080 http://example.com/clear | jq
# - show counters with
# curl -sx localhost:8080 http://example.com/show | jq
import json
import typing
import mitmproxy.http
@thewisenerd
thewisenerd / job_mask.py
Last active May 6, 2023 13:34
repeatable assignment or something idk what i'm doing (also solution wrong)
import math
# https://gist.github.com/cincodenada/6557582
def rotr(num, bits):
num &= (2 ** bits - 1)
bit = num & 1
num >>= 1
if (bit):
num |= (1 << (bits - 1))
import threading
import typing
from dataclasses import dataclass, field
from queue import Queue
from typing import TypeVar, Generic
T = TypeVar('T')
R = TypeVar('R')
  • DONE Domain Fronting to be blocked on Azure
    • HN
    • Azure
    • two https domains resolve to the same IP address
      • eg., (search for site:azureedge.net)
        • tmgpulse.azureedge.net
        • goodie.azureedge.net
      • an SSL request contains of two parts
        • SSL headers which contain "SNI"/server name indicator
  • encrypted HTTP content
#!/usr/bin/env bash
# HAHA, so you may not blame me.
exit 1
set -euo pipefail
# eg sda1
DISK="$1"
interface ExtractHookProps<T> {
extractor: () => T;
setup: (hookValue: T) => void;
}
function ExtractHook<T>(props: React.PropsWithChildren<ExtractHookProps<T>>) {
let {extractor, setup, ...others} = props;
let hookValue = extractor();
setup(hookValue);
return <div {...others} />
# remove analytics boxes on every tweet
twitter.com##div:has(> a[href$="/analytics"]):style(display: none !important)
# remove footer
twitter.com##div:has(> nav[aria-label="Footer"][role="navigation"])
# remove relevant people sidebar
twitter.com##div:has(> aside[aria-label="Relevant people"][role="complementary"])
# one-line for-you|following header
// https://github.com/envoyproxy/data-plane-api/blob/main/envoy/service/ratelimit/v3/rls.proto
syntax = "proto3";
package envoy.service.ratelimit.v3;
service RateLimitService {
rpc ShouldRateLimit(RateLimitRequest) returns (RateLimitResponse) {}
}
@thewisenerd
thewisenerd / UniversalPicturesAU.csv
Created January 4, 2023 06:35
does universal pictures australia bother to renew their domain names
date title yt_id url active registrant debug
20110706 Johnny English Reborn Exclusive Trailer wawSjr2xX74 www.johnnyenglishreborn.com.au False
20111123 Battleship - Global Teaser Trailer 3EtQDQgj3iQ battleshipmovie.com True
20111125 American Pie Reunion f_Sb-xsIKPs americanreunionmovie.com.au False
20120116 American Pie Reunion - Red Band Trailer spv2lOBRDWw americanreunionmovie.com.au False
20120124 American Pie: Reunion - Trailer B QsllnLSOEjM americanreunionmovie.com.au False
20120215 Dr Seuss The LORAX - Zac Efron How to Get a Girl 39vZOPsdT1k www.theloraxmovie.com.au False
20120213 Dr Seuss The LORAX - Zac Efron on Ted kp11JnYDI1E www.theloraxmovie.com.au False
20120217 Dr Seuss The LORAX - Taylor Swift on Audrey wEP-GmqB0xk www.theloraxmovie.com.au False
20120214 Dr Seuss The LORAX - Betty White on Grammy Norma LVpV4jCu7yE www.theloraxmovie.com.au False
package org.dummy.jmhbench
object FeatureFlags {
val enabled: String = System.getenv("FEATURE-FLAG-ENABLED") ?: "false"
val enabledT: Boolean = enabled.toBoolean()
fun viaFunction(): String {
return System.getenv("FEATURE-FLAG-ENABLED") ?: "false"
}