Skip to content

Instantly share code, notes, and snippets.

View meddulla's full-sized avatar

Sofia meddulla

  • Cloudflare
  • Portugal
View GitHub Profile
@meddulla
meddulla / index.ts
Last active July 1, 2024 13:33
Browser rendering and node types
import puppeteer from "@cloudflare/puppeteer";
interface Env {
MYBROWSER: Fetcher;
}
export default {
async fetch(request: Request, env: Env): Promise<Response> {
const url = new URL(request.url);
@meddulla
meddulla / index.ts
Created May 14, 2024 15:50
Cloudflare puppeteer response.text()
import puppeteer from "@cloudflare/puppeteer";
// deploy with $ npx wrangler deploy
export default {
async fetch(request, env, ctx) {
const url = new URL(request.url);
const path = url.pathname
let reqUrl = url.searchParams.get("url") || 'https://example.com';
@meddulla
meddulla / runDevBrowser.mjs
Created January 16, 2024 15:02 — forked from SomeHats/runDevBrowser.mjs
A hacky local version of cloudflare's browser rendering API. To use this, copy either runDevBrowser.ts or runDevBrowser.mjs and install the puppeteer and ws packages from npm. Run the dev server alongside wranger with `node runDevServer.mjs` or `tsx runDevServer.ts`
/* eslint-disable no-console */
/***
* This is a little server that emulates the protocol used by cloudflare's browser rendering API. In
* local development, you can run this server, and connect to it instead of cloudflare's (strictly
* limited) API. e.g. in your worker you might use a function like this:
*
* ```ts
* import { Browser, launch as launchPuppeteer } from '@cloudflare/puppeteer'
* function launchBrowser(env: Environment) {
* if (env.LOCAL_BROWSER_ORIGIN) {
@meddulla
meddulla / tcp_sequence_numbers.org
Last active January 3, 2023 12:05
TCP sequence numbers - example image download

Example image download - Summary table of a client requesting an image

Source: https://packetlife.net/blog/2010/jun/7/understanding-tcp-sequence-acknowledgment-numbers/

Sequence and ack numbers shown here are relative. “When a host initiates a TCP session, its initial sequence number is effectively random; it may be any value between 0 and 4,294,967,295, inclusive. However, protocol analyzers like Wireshark will typically display relative sequence and acknowledgement numbers in place of the actual values. These numbers are relative to the initial sequence number of that stream.”

Packet NrDirectionSeq NrAck NrPayload LenFlagsNotes
@meddulla
meddulla / netflows.csv
Created December 4, 2022 23:19
netflows.csv
Traffic timestamps Traffic values
2022-11-27T22:00:00Z 0.693646
2022-11-27T23:00:00Z 0.650136
2022-11-28T00:00:00Z 0.618255
2022-11-28T01:00:00Z 0.61426
2022-11-28T02:00:00Z 0.625793
2022-11-28T03:00:00Z 0.646856
2022-11-28T04:00:00Z 0.632298
2022-11-28T05:00:00Z 0.635329
2022-11-28T06:00:00Z 0.624986
@meddulla
meddulla / keybase
Created March 27, 2022 00:36
keybase proof
### Keybase proof
I hereby claim:
* I am meddulla on github.
* I am meddulla (https://keybase.io/meddulla) on keybase.
* I have a public key whose fingerprint is A534 24B9 4266 17E5 0660 6CB3 30AB 86FE AD5F 6630
To claim this, I am signing this object:
@meddulla
meddulla / calc.asm.js
Created November 9, 2020 16:24 — forked from thatisuday/calc.asm.js
A simple asm.js module
function Calc(stdlib, foreign, heap) {
"use asm";
function add(a, b) {
a = a|0;
b = b|0;
return (a + b)|0;
}
return {
add: add
};
@meddulla
meddulla / bsdgames-osx.rb
Created October 20, 2020 14:54 — forked from jdmartin/bsdgames-osx.rb
A homebrew formula for installing bsdgames-osx (updated for macOS Sierra). For now, just plunk it into /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/bsdgames-osx.rb (or, put it in ~/.homebrew/Library/Formula/ and specify this path when installing) and run "brew install bsdgames-osx". Tested successfully with MacOS X 10.12.3.
require 'formula'
class BsdgamesOsx < Formula
desc 'The classic bsdgames of yore for Mac OS X and macOS.'
homepage 'https://github.com/ctdk/bsdgames-osx'
url 'https://github.com/ctdk/bsdgames-osx/archive/bsdgames-osx-2.19.3.tar.gz'
sha256 '699bb294f2c431b9729320f73c7fcd9dcf4226216c15137bb81f7da157bed2a9'
head 'https://github.com/ctdk/bsdgames-osx.git'
version '2.19.3'
depends_on "bsdmake" => ':build'
@meddulla
meddulla / Dockerfile
Created May 13, 2020 10:08 — forked from dceejay/Dockerfile
Dockerfile for Node-RED
# Dockerfile for Node-RED - pulls latest master code from git
# Use the node.js v4 LTS engine
FROM node:4-slim
MAINTAINER ceejay
RUN mkdir -p /root/.node-red
WORKDIR /root/.node-red
# download latest stable node-red
RUN npm install -g --unsafe-perm node-red
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory