Skip to content

Instantly share code, notes, and snippets.

View watzon's full-sized avatar
👀
Looking for work

Chris Watson watzon

👀
Looking for work
View GitHub Profile
@watzon
watzon / proof.md
Last active November 22, 2024 06:29

aspe:keyoxide.org:53LRCXONXJ2LZQWY6KZMILBJKQ

@watzon
watzon / local-overrides.quirks
Created November 7, 2024 04:12
Fix Synaptic touchpad issues on Dell laptops on Linux
# /etc/libinput/local-overrides.quirks
[Device]
MatchName=SynPS/2 Synaptics TouchPad
MatchUdevType=touchpad
MatchBus=ps2
# We need to add a valid DMI modalias match as required
MatchDMIModalias=dmi:*
# Disable the device by telling libinput to ignore its input properties
@watzon
watzon / with_std.cr
Last active September 25, 2023 06:05
Crystal function to capture stdin and stdout and redirect them within the block, returning an array containing 2 strings
def with_std(&block)
original_stdout = File.open("/dev/null")
original_stdout.reopen(STDOUT)
original_stderr = File.open("/dev/null")
original_stderr.reopen(STDERR)
stdout_reader, stdout_writer = IO.pipe
stderr_reader, stderr_writer = IO.pipe
import { useState } from "preact/hooks";
export interface MessageInputProps {
onSubmit: (message: { content: string; image: string | null }) => void;
}
const MessageInput = ({ onSubmit }: MessageInputProps) => {
const [message, setMessage] = useState<string>("");
const [image, setImage] = useState<string | null>(null);
@watzon
watzon / promptconvert.py
Created February 22, 2023 04:22
Stable Diffusion WebUI to InvokeAI prompt conversion script
import re
import argparse
re_attention = re.compile(r"""
\\\(|
\\\)|
\\\[|
\\]|
\\\\|
\\|

Keybase proof

I hereby claim:

  • I am watzon on github.
  • I am watzon (https://keybase.io/watzon) on keybase.
  • I have a public key whose fingerprint is 51B2 65DD 8352 2995 046F C8D6 3670 7B02 0200 D3D9

To claim this, I am signing this object:

@watzon
watzon / tagcopier.js
Created October 21, 2022 01:09
Danbooru Tag Copier
// ==UserScript==
// @name Danbooru Tag Copier
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Automatically copy all general tags from danbooru page to your clipboard
// @author watzon
// @match https://danbooru.donmai.us/posts/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=donmai.us
// @grant none
// ==/UserScript==
KNOWN_ID_MAP = { 2768409 => 1383264000000, 7679610 => 1388448000000, 11538514 => 1391212000000, 15835244 => 1392940000000, 23646077 => 1393459000000, 38015510 => 1393632000000, 44634663 => 1399334000000, 46145305 => 1400198000000, 54845238 => 1411257000000, 63263518 => 1414454000000, 101260938 => 1425600000000, 101323197 => 1426204000000, 111220210 => 1429574000000, 103258382 => 1432771000000, 103151531 => 1433376000000, 116812045 => 1437696000000, 122600695 => 1437782000000, 109393468 => 1439078000000, 112594714 => 1439683000000, 124872445 => 1439856000000, 130029930 => 1441324000000, 125828524 => 1444003000000, 133909606 => 1444176000000, 157242073 => 1446768000000, 143445125 => 1448928000000, 148670295 => 1452211000000, 152079341 => 1453420000000, 171295414 => 1457481000000, 181783990 => 1460246000000, 222021233 => 1465344000000, 225034354 => 1466208000000, 278941742 => 1473465000000, 285253072 => 1476835000000, 294851037 => 1479600000000, 297621225 => 1481846000000, 328594461 => 1482969000000, 337808429 =
@watzon
watzon / portainer-agent-caddy.yml
Created December 21, 2021 16:45
Portainer + Caddy = <3
version: '3.3'
services:
agent:
image: portainer/agent:latest
environment:
AGENT_CLUSTER_ADDR: tasks.agent
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /var/lib/docker/volumes:/var/lib/docker/volumes
import { Api, TelegramClient } from 'telegram'
import { EditMessageParams, SendMessageParams } from 'telegram/client/messages';
import { Entity, EntityLike } from 'telegram/define'
import { EventBuilder, EventCommon } from "telegram/events/common";
import { toSignedLittleBuffer } from 'telegram/Helpers';
import { getInputPeer, _getEntityPair } from 'telegram/Utils';
import { escapeRegExp } from '../utils';
export interface NewCallbackQueryInterface {
chats: EntityLike[];