Skip to content

Instantly share code, notes, and snippets.

import sys, os, stat, errno, operator, time, datetime, requests
from fuse import FUSE, Operations, LoggingMixIn, FuseOSError
from mastodon import Mastodon
from cachetools import TTLCache, cachedmethod
from mastodon.return_types import MediaAttachment, Account, Status
class PathItem:
def __init__(self, path_type, mtime=None, size=0, symlink_target=None, read_fn=None, listdir_fn=None):
self.path_type = path_type
self.mtime = mtime or time.time()
import pyaudio
import numpy as np
import time
import queue
import threading
from collections import deque
import os
import signal
# Frequency range to check for peaks.
@halcy
halcy / monads.py
Last active February 14, 2022 23:33
# very very simple monad: Maybe
class Maybe:
def __init__(self, value, valid = True):
self.value = value
self.valid = valid
def get_value(self):
return self.value
def has_value(self):
Mastodon.py debug:
Mastodon: Request to endpoint "http://localhost:3000/api/v1/push/subscription" using method "PUT".
Parameters: {'data[alerts][follow]': False, 'data[alerts][favourite]': False, 'data[alerts][reblog]': False, 'data[alerts][mention]': False}
Headers: {'Authorization': 'Bearer __MASTODON_PY_TEST_ACCESS_TOKEN'}
Files: {}
Mastodon: Response received with code 200.
response headers: {'Content-Encoding': 'gzip', 'X-Runtime': '0.029487', 'Content-Type': 'application/json; charset=utf-8', 'X-Permitted-Cross-Domain-Policies': 'none', 'X-XSS-Protection': '1; mode=block', 'Vary': 'Accept-Encoding, Origin', 'X-Content-Type-Options': 'nosniff', 'X-Request-Id': 'ffb15570-ecf3-445e-b2cd-91d67bd5642c', 'Referrer-Policy': 'strict-origin-when-cross-origin', 'X-Frame-Options': 'SAMEORIGIN', 'Cache-Control': 'no-cache, no-store', 'X-Download-Options': 'noopen'}
Response text content: {"id":33,"endpoint":"https://example.com","alerts":{"follow":true,"favourite":true,"reblog":true,"mention":true},"server_key":"B
@halcy
halcy / detect_marker.py
Created April 24, 2019 16:45 — forked from ksasao/detect_marker.py
ZOZOSUITのマーカーのIDを読み取るコードです。公開されている画像を元に独自に解析しているので、公式ではこのように処理しているかどうかは不明です。仕様等については https://twitter.com/ksasao/status/990779583682170881 のスレッドも参照してください。全身を読み取るコード https://twitter.com/ksasao/status/989842844243279872 ライセンスは Apache License 2.0 です。
import numpy as np
import random
import math
import cv2
from PIL import Image
import sys
def detect_markers(im):
markers = []
# 輪郭線抽出のための二値化
$citra = 'C:\Users\halcy\AppData\Local\citra\app-0.1.463\citra-qt.exe'
$watcher = New-Object System.IO.FileSystemWatcher
$watcher.Path = get-location
$watcher.Filter = "*.3dsx"
$watcher.IncludeSubdirectories = $false
$watcher.EnableRaisingEvents = $false
$watcher.NotifyFilter = [System.IO.NotifyFilters]::LastWrite -bor [System.IO.NotifyFilters]::FileName
while($TRUE){
3
+state_000!
0 left state_002 2
1 up state_001 2
2 right state_003 1
+state_001
0 left state_003 1
1 down state_001 1
@halcy
halcy / tm2.py
Last active July 17, 2017 22:13
# coding: utf-8
###
# Small "compiler" for Turing Drawings
# https://maximecb.github.io/Turing-Drawings
#
# Syntax should be fairly obvious from looking at the given code
###
@halcy
halcy / tm.py
Last active July 17, 2017 17:55
def compile_tm(source_code):
# First pass: Parse code
lines = source_code.splitlines()
states = {}
initial_state = ""
state_name = ""
symbol_count = 0
for line in lines:
# Skip comments, whitespace

Keybase proof

I hereby claim:

  • I am halcy on github.
  • I am halcy (https://keybase.io/halcy) on keybase.
  • I have a public key whose fingerprint is 45AD 97C5 3E68 29D5 5C28 7151 14C9 DEE3 C395 A2EB

To claim this, I am signing this object: