Skip to content

Instantly share code, notes, and snippets.

[Physics::Module] Initialized MultithreadedJobDispatcher with 23 workers.
Initialize engine version: 2022.3.11f1m1 (0)
[Subsystems] Discovering subsystems at path D:/Program Files (x86)/Steam/steamapps/common/NoRestForTheWicked/NoRestForTheWicked_Data/UnitySubsystems
GfxDevice: creating device client; threaded=1; jobified=1
Direct3D:
Version: Direct3D 11.0 [level 11.1]
Renderer: NVIDIA GeForce RTX 4090 (ID=0x2684)
Vendor: NVIDIA
VRAM: 24142 MB
Driver: 31.0.15.5222
@crhan
crhan / vscode_container_initialize.py
Created April 17, 2022 01:08
vscode_container_initialize.py
#!/usr/bin/env python3
import hashlib
import logging
import os
import time
from pathlib import Path
logging.basicConfig(
format="%(asctime)s - %(filename)s:%(lineno)d - %(levelname)s - %(message)s",
level=logging.DEBUG,
from sly import Lexer, Parser
import pytest
from enum import Enum
class QUOTE(Enum):
START = 0
END = 1
import re
from iredis.commands_csv_loader import all_commands
from iredis.exceptions import InvalidArguments
from iredis.utils import split_command_args
from prompt_toolkit import PromptSession
from prompt_toolkit.auto_suggest import AutoSuggestFromHistory
from prompt_toolkit.completion import CompleteEvent, Completer, WordCompleter
from prompt_toolkit.document import Document
from prompt_toolkit.history import FileHistory
@crhan
crhan / pyproject.toml
Created October 8, 2019 10:02
poetry bug produce toml
[tool.poetry]
name = "20191008"
version = "0.1.0"
description = ""
authors = ["ruohan.chen <[email protected]>"]
[tool.poetry.dependencies]
python = "^2.7, <3.0 || ^3.7, < 3.8"
@crhan
crhan / install-setup.txt
Last active October 9, 2018 06:16 — forked from dropwhile/install-setup.txt
python serialization speed comparison
virtualenv --no-site-packages hodor
hodor/bin/pip install simplejson ujson cbor tnetstring msgpack-python
curl -s 'http://www.json-generator.com/api/json/get/cvfsLVmKiG?indent=2' > test.json
hodor/bin/python shootout.py
@crhan
crhan / README.md
Last active September 19, 2018 14:40
MotionLights for HomeAssistant

支持的功能:

  1. 支持光照度条件, 环境光足够亮就不开灯, 例如阳台灯
  2. 支持多个 sensor 共同触发, 例如卫生间可以放两个人体传感器, 玄关可以放一个门窗传感器+人体传感器
  3. 支持只关不开(厕所排气扇场景)或者只开不关(不知道为啥要这样, 你想到了告诉我)
  4. 支持延时关闭, 根据自身情况设定, 规避人体传感器不灵敏的问题

这个功能不适合经常有人呆着的地方, 比如书房, 卧室, 客厅.

@crhan
crhan / README.md
Last active April 12, 2017 22:56 — forked from chuangbo/README.md
Python dynamic DNSPod DNS Script

替换上你的 Token,域名ID,记录ID等参数,就可以运行了。 跟原代码不同的是,该版本每次执行就运行一次,方便使用调度系统来进行调度

获得domain_id可以用curl curl -k https://dnsapi.cn/Domain.List -d "login_token=xxx"

获得record_id类似 curl -k https://dnsapi.cn/Record.List -d "login_token=xxx&amp;domain_id=xxx"

@crhan
crhan / README.md
Last active February 20, 2017 05:30
DHCPd Detector

DHCPd Detector

Useful tool for sniffing DHCP Server on specified Interface

How to use

python dhcpd_detector.py [--config <filename>.cfg]

Configure

@crhan
crhan / operating_system.rb
Last active September 12, 2016 15:10
rbenv.spec
module Gem
class << self
##
# Returns full path of previous but one directory of dir in path
# E.g. for '/usr/share/ruby', 'ruby', it returns '/usr'
def previous_but_one_dir_to(path, dir)
split_path = path.split(File::SEPARATOR)
File.join(split_path.take_while { |one_dir| one_dir !~ /^#{dir}$/ }[0..-2])