Skip to content

Instantly share code, notes, and snippets.

View fantix's full-sized avatar
🤯

Fantix King fantix

🤯
View GitHub Profile
================================================================================
Input graphql
================================================================================
mutation update_RangeTest(
$rval: RangeOfFloat,
$mval: [RangeOfFloat!],
$rdate: RangeOfString,
$mdate: [RangeOfString!]
) {
@fantix
fantix / gist:31a6f0ac8adbe5cc14b8d42a85493bd4
Created August 7, 2023 16:55
gnome-shell crash after youtube play
8月 07 12:53:04 fantix-pc gnome-shell[25632]: Source ID 2332 was not found when attempting to remove it
8月 07 12:53:06 fantix-pc gnome-shell[25632]: Error connecting to the screencast service
8月 07 12:53:12 fantix-pc systemd[1]: systemd-hostnamed.service: Deactivated successfully.
8月 07 12:53:14 fantix-pc systemd[1]: systemd-localed.service: Deactivated successfully.
8月 07 12:53:20 fantix-pc dbus-daemon[25486]: [session uid=1000 pid=25486] Activating via systemd: service name='org.freedesktop.Flatpak' unit='flatpak-session-helper.service' requested by ':1.95' (uid=1000 pid=26646 comm="/usr/bin/flatpak run --branch=stable --arch=x86_64")
8月 07 12:53:20 fantix-pc systemd[936]: Starting flatpak session helper...
8月 07 12:53:20 fantix-pc systemd[936]: Started Application launched by gnome-shell.
8月 07 12:53:20 fantix-pc dbus-daemon[25486]: [session uid=1000 pid=25486] Successfully activated service 'org.freedesktop.Flatpak'
8月 07 12:53:20 fantix-pc systemd[936]: Started flatpak session helper.
8月 07 12:53:20 fanti

Keybase proof

I hereby claim:

  • I am fantix on github.
  • I am fantix (https://keybase.io/fantix) on keybase.
  • I have a public key whose fingerprint is 86EE EC21 4D24 5137 446F 4AB1 9530 4B04 071C CDB4

To claim this, I am signing this object:

@fantix
fantix / main.rs
Last active November 7, 2022 22:58 — forked from divi255/main.rs
Test Rust shared resource guards
#[macro_use]
extern crate lazy_static;
use std::sync::atomic::{AtomicBool, AtomicU64, Ordering};
use std::thread::sleep;
use std::time::Duration;
static READERS: u64 = 100;
static WRITERS: u64 = 2;
static RUNNING: AtomicBool = AtomicBool::new(true);
@fantix
fantix / local_ca.py
Created June 17, 2021 16:03
Local CA with cryptography
import datetime
import os
import socket
import ssl
import threading
import uuid
from cryptography import x509
from cryptography.hazmat import backends
from cryptography.hazmat.primitives import hashes
import asyncio
import functools
import signal as signal_mod
import warnings
def _release_waiter(waiter, *args):
if not waiter.done():
waiter.set_result(None)
test_api_errors_01 (test_api_errors.TestErrorsClasses) 0.0005875366666335443 3
test_api_errors_02 (test_api_errors.TestErrorsClasses) 0.00033936866672471905 3
test_common_ast_copy (common.test_ast.ASTBaseTests) 0.0005624686666199826 3
test_common_ast_match (common.test_ast.ASTMatchTests) 0.002293278333316569 3
test_common_ast_type_anno (common.test_ast.ASTBaseTests) 0.0014174716666654301 3
test_common_ast_typing (common.test_ast.ASTBaseTests) 0.0043385533333548665 3
test_common_checked_checkeddict_basics (common.test_checked.CheckedDictTests) 0.0013698453333290672 3
test_common_checked_checkeddict_pickling (common.test_checked.CheckedDictTests) 0.0007251706666693281 3
test_common_checked_checkedlist_basics (common.test_checked.CheckedListTests) 0.0006082380000028328 3
test_common_checked_checkedset_basics (common.test_checked.CheckedSetTests) 0.0007858390000213452 3
<!DOCTYPE html>
<html>
<head>
<link href="https://cdnjs.cloudflare.com/ajax/libs/normalize/4.1.1/normalize.min.css" rel="stylesheet"
type="text/css"/>
<script charset="utf-8" src="https://d3js.org/d3.v3.js"></script>
<style>
html {
@fantix
fantix / sa_fastapi.py
Created September 16, 2020 06:22
Why you shouldn't use SQLAlchemy 1.3 with FastAPI
"""
This code demonstrates how FastAPI server freezes with SQLAlchemy under concurrency,
if you're mixing blocking operations with async calls inproperly.
(pip install sqlalchemy httpx fastapi uvicorn)
You will see 15 (not 20!) "Handling xxx", then the server freezes for minutes,
refusing to serve any request.
This is caused by "resource starvation" - the default SQLAlchemy connection pool size
@fantix
fantix / openapi.json
Created February 11, 2020 22:40
Gen3 Metadata Service
{"openapi":"3.0.2","info":{"title":"DCFS Metadata Service","version":"1.2.0a0"},"paths":{"/version":{"get":{"summary":"Get Version","operationId":"get_version_version_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/_status":{"get":{"summary":"Get Status","operationId":"get_status__status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/metadata_index":{"get":{"tags":["Index"],"summary":"List Metadata Indexes","description":"List all the metadata key paths indexed in the database.","operationId":"list_metadata_indexes_metadata_index_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBasic":[]}]}},"/metadata_index/{path}":{"post":{"tags":["Index"],"summary":"Create Metadata Indexes","description":"Create a database index on the given metadata key path.","operationId":"create_metadata_indexes_metadata_index__path_