Skip to content

Instantly share code, notes, and snippets.

View Wallacy's full-sized avatar

Wallacy Freitas Wallacy

View GitHub Profile
@johnspurlock-skymethod
johnspurlock-skymethod / r2-notes.md
Last active March 13, 2024 17:32
Unofficial R2 notes
@jacwright
jacwright / concurrency.ts
Last active December 13, 2021 03:28
Concurrency: Easy, Fast, Correct — Choose three
/**
* Simplify concurrency using the strategies described in
* https://blog.cloudflare.com/durable-objects-easy-fast-correct-choose-three/ using input gates and output gates by
* allowing certain actions to block other actions or to block the responses of other actions.
* To "block" an action or response means to defer it until after the blocking actions have been processed. This
* allows the state of an object to be consistent and avoid race conditions which may be hard to discover.
* It is a good idea to use this in conjunction with a cache for blockable actions (e.g. a storage mechanism) to ensure
* the blocking doesn't slow down the system.
*
* Definitions:
@lucacasonato
lucacasonato / README.md
Last active April 3, 2021 22:43
FetchEvent polyfill in Deno, with demo

This example demonstrates how to polyfill the "fetch" event in Deno, and gives an example for how this can be used to run Cloudflare Workers in Deno.

To try it locally run the script below, and visit http://0.0.0.0:8080:

$ deno run --allow-net https://gist.githubusercontent.com/lucacasonato/1a30a4fa6ef6c053a93f271675ef93fc/raw/efcdc8e798604e194831830fcb962b50261384b3/example-worker.js
@theinternetftw
theinternetftw / block-5-phone-presser.md
Last active January 6, 2023 17:11
Block 5 Phone Presser

Block 5 Phone Presser

2018-05-10

James Gleeson, SpaceX PR: Quick thank you to everyone for joining us on today's call. We're just a little over two hours from the launch of the Bangabandhu satellite's mission and the first flight of Falcon 9 Block 5. We have about 30 minutes for today's call to discuss the upgrades made to the Falcon 9 launch vehicle, and we'd like to get through as many of your questions as possible in that time. So to keep the conversation flowing, please limit your

@lattner
lattner / TaskConcurrencyManifesto.md
Last active June 8, 2024 03:41
Swift Concurrency Manifesto
@lattner
lattner / async_swift_proposal.md
Last active April 21, 2024 09:43 — forked from oleganza/async_swift_proposal.md
Concrete proposal for async semantics in Swift

Async/Await for Swift

Introduction

Modern Cocoa development involves a lot of asynchronous programming using closures and completion handlers, but these APIs are hard to use. This gets particularly problematic when many asynchronous operations are used, error handling is required, or control flow between asynchronous calls gets complicated. This proposal describes a language extension to make this a lot more natural and less error prone.

This paper introduces a first class Coroutine model to Swift. Functions can opt into to being async, allowing the programmer to compose complex logic involving asynchronous operations, leaving the compiler in charge of producing the necessary closures and state machines to implement that logic.

@Manouchehri
Manouchehri / cloudflare.sh
Last active June 14, 2024 00:55
Allow CloudFlare only
# Source:
# https://www.cloudflare.com/ips
# https://support.cloudflare.com/hc/en-us/articles/200169166-How-do-I-whitelist-CloudFlare-s-IP-addresses-in-iptables-
for i in `curl https://www.cloudflare.com/ips-v4`; do iptables -I INPUT -p tcp -m multiport --dports http,https -s $i -j ACCEPT; done
for i in `curl https://www.cloudflare.com/ips-v6`; do ip6tables -I INPUT -p tcp -m multiport --dports http,https -s $i -j ACCEPT; done
# Avoid racking up billing/attacks
# WARNING: If you get attacked and CloudFlare drops you, your site(s) will be unreachable.
iptables -A INPUT -p tcp -m multiport --dports http,https -j DROP
@cloudwu
cloudwu / dh.c
Last active June 19, 2022 15:38
Diffie-Hellman Key Exchange
// The biggest 64bit prime
#define P 0xffffffffffffffc5ull
#define G 5
#include <stdio.h>
#include <stdint.h>
#include <assert.h>
#include <stdlib.h>
// calc a * b % p , avoid 64bit overflow