Skip to content

Instantly share code, notes, and snippets.

@thewisenerd
thewisenerd / Dockerfile
Created January 18, 2024 14:17
docker stretch ca-certificates letsencrypt
# Update stretch repositories
RUN sed -i -e 's/deb.debian.org/archive.debian.org/g' \
-e 's|security.debian.org|archive.debian.org|g' \
-e '/stretch-updates/d' /etc/apt/sources.list
# LetsEncrypt DST Root CA X3 expired on 2021-09-30
# https://letsencrypt.org/docs/dst-root-ca-x3-expiration-september-2021/
RUN sed -i '/^mozilla\/DST_Root_CA_X3.crt$/ s/^/!/' /etc/ca-certificates.conf
RUN update-ca-certificates
import * as openpgp from 'openpgp';
import {Octokit} from "@octokit/rest";
const privateKeyArmored: string = `-----BEGIN PGP PRIVATE KEY BLOCK-----
HAHAHAHA did you really think
-----END PGP PRIVATE KEY BLOCK-----
`;
async function createEmptyCommit(
octokit: Octokit,
#include <assert.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#define ONE_MB (1024 * 1024)
#define SLEEP_BUF_DEFAULT 16 // wait 1s every N MB
#define SLEEP_BUF_MIN 0
#define SLEEP_BUF_MAX (1024 * 1024) // surely nobody has 1 TB lying around
@thewisenerd
thewisenerd / not-alert.py
Last active July 19, 2023 03:40
send slack alert if output file doesn't see any additions for 5 minutes
import glob
import json
import os
import sys
import time
import typing
import urllib.request
period_in_seconds = 60
watch_time_seconds = 300
import java.util.Base64
private data class ContinuationDebugPart(
val a: Int,
val b: Int,
val key: String
) {
override fun toString(): String {
return "[$a!$b!$key]"
@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"