Skip to content

Instantly share code, notes, and snippets.

View no1xsyzy's full-sized avatar

Xu Siyuan no1xsyzy

  • SH, China
View GitHub Profile
@no1xsyzy
no1xsyzy / DefaultQuests.json
Created February 18, 2024 14:54
The `DefaultQuests.json` file for Skyexchange w/ Compressed Sand quest problem fixed. 🎉
{
"editMode": false,
"hardcore": false,
"defLives": 3,
"maxLives": 10,
"questDatabase": [
{
"questID": 0,
"name": "Builder\u0027s Best Friend",
"description": "Building wand and destruction wand can manuplate the world efficently. Angel blocks doesn\u0027t need a block to be placed against.",
#!/usr/bin/env python3
"""Usage: ... | pipe-throttle.py [NUMBER]
Read and write 1 byte, then sleep for NUMBER seconds.
Keep doing this until cannot read anything.
If NUMBER is not provided, sleep for 1 second instead.
-h, --help display this help and exit
"""
@no1xsyzy
no1xsyzy / test.md
Last active December 9, 2020 03:40

Testing tables

simple_tables

Right Left Center Default


 12     12        12            12
123     123       123          123
  1     1          1             1
import os
import sys
import time
from functools import cached_property
from multiprocessing import Pool
from PyQt5.QtCore import QObject, pyqtSignal, QThread
from PyQt5.QtWidgets import QApplication, QVBoxLayout, QWidget
from PyQt5.QtWidgets import QPushButton
from multiprocessing import Process, Queue
from queue import Empty
from PyQt5.QtWidgets import *
from PyQt5.QtCore import QTimer
def calc(q):
q.put(sum(i**i for i in range(10000)))
import numpy as np
from numpy import matmul
from numpy.linalg import inv
class V2_697506(dict):
def __missing__(self, key):
x, y = key
if y == 0: # rule 1
self[x, y] = 0
@no1xsyzy
no1xsyzy / auto-ssh-agent
Created June 10, 2020 08:00
Make ssh-agent idempotent
# Usage: . /path/to/auto-ssh-agent
# Check if exists ssh-agent in current session
if env | grep -q '^SSH'; then
echo Agent pid $SSH_AGENT_PID;
else
# Cached ssh-agent info is user-specified
_SOURCE_DIR="~/.local/run"
_SOURCE_FILE="${_SOURCE_DIR}/ssh-agent"
# WTFPL
import requests
from collections import defaultdict
from itertools import count
from pprint import pprint
session = requests.Session()
session.proxies = {
'http': 'http://localhost:1081',
import random
from decimal import *
from fractions import *
from typing import *
PRECISION = Decimal('0.0001')
def create_randoms(size: int = 30) -> List[int]:
return [random.randrange(1, 100) for _ in range(size)]
@no1xsyzy
no1xsyzy / defers.py
Created March 26, 2020 11:25
Just tired with seemingly infinite try ... finally or with ... as.
# WTFPL
import functools
class Defers:
def __init__(self):
self._defereds = []
def add_defer(self, defer_func):
self._defereds.append(defer_func)