Skip to content

Instantly share code, notes, and snippets.

View johtso's full-sized avatar
🤖

Johannes johtso

🤖
View GitHub Profile
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)
@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')
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 / gist:5881137
Last active February 18, 2021 18:37
Django Rest Framework underscore <-> camelcase conversion
import re
from rest_framework import serializers, renderers, parsers
class JSONRenderer(renderers.JSONRenderer):
def render(self, data, *args, **kwargs):
if data:
data = recursive_key_map(underscore_to_camelcase, data)
return super(JSONRenderer, self).render(data, *args, **kwargs)
@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
@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"
// 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 / 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>;