Skip to content

Instantly share code, notes, and snippets.

@belm0
belm0 / article_sc_and_lua_1.md
Last active October 23, 2024 18:04
Structured concurrency and Lua (part 1)

Structured concurrency and Lua (part 1)

John Belmonte, 2022-Sep

I've started writing a toy structured concurrency implementation for the Lua programming language. Some motivations:

  • use it as a simple introduction to structured concurrency from the perspective of Lua (this article)
  • learn the fundamental properties of structured concurrency and how to implement them
  • share code that could become the starting point for a real Lua library and framework

So what is structured concurrency? For now, I'll just say that it's a programming paradigm that makes managing concurrency (arguably the hardest problem of computer science) an order of magnitude easier in many contexts. It achieves this in ways that seem subtle to us—clearly so, since its utility didn't reach critical mass until around 2018[^sc_birth] (just as control structures like functions, if, and while weren't introduced to languages until long after the first compu

@TylerWanner
TylerWanner / README.md
Last active March 4, 2024 20:54
Terraform Deploy Prefect Server to GCP

Provisioning Prefect Server on GCP using Terraform

Requirements: Terraform, GCP credentials with permission to create a project Tested with: Terraform v0.12.23, google cloud provider v3.26

To run:

You can use an environment variable to set which service account key to use during provisioning export GOOGLE_APPLICATION_CREDENTIALS=/path/to/key The service account you use must belong to a GCP project that has the necessary APIs enabled (such as billing and resource manager)--if it does not, you may have to enable these APIs manually along the way in those projects In this directory, run terraform init then terraform apply -- you will need to provide a billing_id and organization_id for your GCP project

Once successful, be sure to add the following to your ~/.prefect/config.toml

@popon-01
popon-01 / dmm_adc_15.md
Last active December 19, 2019 02:50
関数リアクティブプログラミング(FRP)と自己の紹介

関数リアクティブプログラミング(FRP)と自己の紹介

この記事はDMMグループ'20卒内定者アドベントカレンダー15日目の記事です.

現在修士2年,プログラミング言語の研究室に所属していて関数リアクティブプログラミング (Functional Reactive Programming, FRP) というプログラミングパラダイムの研究をしています.修論も佳境!終わらない実装!ということで自己紹介がてらFRPの簡単な紹介でも書こうかなと思います.

関数リアクティブプログラミング(FRP)とは

関数リアクティブプログラミング(FRP)はリアクティブなソフトウェアの記述をサポートするプログラミングパラダイムです.

アプリケーションのUIや制御システムなど,外部からの入力に応答するようなソフトウェアの場合にはキー入力やセンサーの値などの非同期的な入力を処理する必要があります.非同期的な入力に対する処理はポーリング・コールバック関数・マルチスレッディングなどで実装されるわけですが,これらが組み合わさってくると実行の流れが把握しづらくなり,プログラムが複雑になってしまいます.

@nullkal
nullkal / aquaskk_iterm2.json
Last active May 15, 2022 05:32
AquaSKK + iTerm2環境でのCtrl-J問題を解決するためのKarabiner-ElementsのComplex Modificationsルール
{
"title": "AquaSKK",
"rules": [
{
"description": "Ctrl-J to Kana on Apple Terminal/iTerm2",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "j",
#!/usr/bin/node --harmony
const data = {
username: '12X34567',
password: 'abcde12345'
};
const address = [
'https://',
'\x77\x6C\x61\x6E\x61\x75\x74\x68\x2E\x6E\x6F\x63\x2E\x74\x69\x74\x65\x63\x68\x2E\x61\x63\x2E\x6A\x70\x2F\x6C\x6F\x67\x69\x6E',
'.html'
@okumin
okumin / akka-persistence.md
Created September 28, 2014 08:55
akka-persistenceのプラグインをつくろう
@staltz
staltz / introrx.md
Last active November 14, 2024 11:27
The introduction to Reactive Programming you've been missing
@id
id / gist:cba5dbf7653d7eab6a03
Last active March 26, 2024 15:55
Tracing in erlang
F = fun(F, Fd) -> receive stop -> io:format(Fd, "stop~n", []), file:close(Fd), ok; Msg -> io:format(Fd, "~p~n", [Msg]), F(F, Fd) end end.
{ok, Fd} = file:open("/tmp/trace.out", [write]), Tracer = proc_lib:spawn(fun() -> F(F, Fd) end).
%% trace everything
erlang:trace(Pid, true, [all, {tracer, Tracer}]).
%% stop tracing
erlang:trace(Pid, false, [all, {tracer, Tracer}]).
Tracer ! stop.
%% match pattern
@YoEight
YoEight / Dyna.hs
Last active August 2, 2022 19:44
Computes Fibonacci number with a histomorphism -- correction: Actually it's a dynamorphism as it uses an anamorphism to generate intermediary step
data Cofree f a = a :< (f (Cofree f a))
-- Fix point
newtype Mu f = Mu { unMu :: f (Mu f) }
extract :: Cofree f a -> a
extract (a :< _) = a
-- catamorphism
cata :: Functor f => (f b -> b) -> Mu f -> b
@dagoof
dagoof / PEG.py
Created September 11, 2012 13:25
Minimal Python PEG implementation
import functools, itertools, operator
import json
class attrdict(dict):
def __getattr__(self, key): return self.get(key)
def __setattr__(self, key, value): self[key] = value
def rankedresult(rank, result):
return attrdict(rank = rank, result = result)