Skip to content

Instantly share code, notes, and snippets.

View johtso's full-sized avatar
🤖

Johannes johtso

🤖
View GitHub Profile
@johtso
johtso / effect-error-schema.ts
Created July 4, 2024 09:57
One-shot error decoding from full response using a single union Effect schema
import { Schema as S, AST } from "@effect/schema"
import * as Errors from "./errors"
import { Either, Option } from "effect"
const overwriteTag = <Tag extends AST.LiteralValue>(tag: Tag) =>
S.optionalToRequired(S.Unknown, S.Literal(tag), {
decode: () => tag,
encode: () => Option.none()
}).pipe(S.withConstructorDefault(() => tag))
@johtso
johtso / index.ts
Created February 24, 2023 15:04 — forked from huw/README.md
Remix, Sentry & Cloudflare Workers
import * as build from "@remix-run/dev/server-build";
import { createRoutes } from "@remix-run/server-runtime/dist/routes";
import { Dedupe, ExtraErrorData, Transaction } from "@sentry/integrations";
import { hasTracingEnabled } from "@sentry/tracing";
import { Toucan } from "toucan-js";
import createEventHandler from "./createEventHandler";
import instrumentBuild, { getTransactionName, startRequestHandlerTransaction } from "./instrumentBuild";
interface Environment {
__STATIC_CONTENT: KVNamespace<string>;
// Name: daily note
// Description: Open today's daily note in obsidian
// You must install the Actions URI plugin and have the daily notes plugin enabled
// Currently MacOS only
import "@johnlindquist/kit"
import { homedir } from "os"
import { join as joinPath } from "path"
@johtso
johtso / daily-note.ts
Created February 13, 2023 23:04
Open today's daily note in Obsidian
// Name: daily note
// Description: Open today's daily note in obsidian
// You must install the Actions URI plugin and have the daily notes plugin enabled
// Currently MacOS only
import "@johnlindquist/kit"
import { homedir } from "os"
import { join as joinPath } from "path"
@johtso
johtso / canvas-drawing-7gui-tasks-challenge-keyframers-7-8-6.markdown
Created April 25, 2022 12:47
Canvas Drawing! | 7GUI Tasks Challenge | @keyframers 7.8.6
import inspect
from typing import Callable, Generator, Awaitable, TypeVar, Union
YieldType = TypeVar("YieldType")
SendType = TypeVar("SendType")
ReturnType = TypeVar("ReturnType")
def friendly_generator_decorator(
genfunction: Callable[..., Generator[YieldType, SendType, ReturnType]],
handler: Callable[[YieldType], Union[Awaitable[SendType], SendType]],
@johtso
johtso / tott_rate_monitor.py
Created May 27, 2016 09:23
Output counts of URLs scanned on URLTeam project
import sys
import json
import websocket
ws = websocket.create_connection('ws://tracker.archiveteam.org:1337/api/live_stats')
username = sys.argv[1]
while True:
data = json.loads(ws.recv()).get('live_new')
getdirentries64(0x6, 0x7FD7728E2A00, 0x1000) = 1192 0
close_nocancel(0x6) = 0 0
fstat64(0x5, 0x7FFF50CE06D0, 0x1000) = 0 0
fstat64(0x5, 0x7FFF50CE0720, 0x1000) = 0 0
open_nocancel("/Users/human/.virtualenvs/main/lib/python2.7/site-packages/salt/renderers/mako.pyc\0", 0x0, 0x1B6) = 6 0
fstat64(0x6, 0x7FFF50CE04F8, 0x1B6) = 0 0
read_nocancel(0x6, "\003\363\r\nK\2012Tc\0", 0x1000) = 1282 0
fstat64(0x6, 0x7FFF50CE0608, 0x1000) = 0 0
read_nocancel(0x6, "\n .hostmask: IPv4Address('0.0.0.31')\n .broadcast: IPv4Address('1.2.3.31')\n .netmask: IPv4Address('255.255.255.224')\n .prefixlen: 27\n\n i\377\0", 0x1000) = 0 0
close_nocancel(0x6) = 0 0

Keybase proof

I hereby claim:

  • I am johtso on github.
  • I am johtso (https://keybase.io/johtso) on keybase.
  • I have a public key whose fingerprint is 480D 27DC 20A4 E61E F849 037C 581B 992E 7F19 4964

To claim this, I am signing this object:

from kivy.app import App
from kivy.uix.button import Button
from android import activity
__version__ = '0.0.1'
class MyApp(App):
def __init__(self, *args, **kwargs):
super(MyApp, self).__init__(*args, **kwargs)