Skip to content

Instantly share code, notes, and snippets.

View sqybi's full-sized avatar
🙏
少女祈祷中...

Qingyu Sui sqybi

🙏
少女祈祷中...
View GitHub Profile
@sqybi
sqybi / genshin_fungus.py
Created November 13, 2022 05:43
原神 3.2 版本 花花琼脂蕈兽培养步数计算
from copy import deepcopy
IDENTIFIER_BASE = 3
def get_identifier(state):
identifier = 0
for line in state:
for x in line:
identifier *= IDENTIFIER_BASE
@sqybi
sqybi / pagerank.py
Last active August 10, 2022 04:08
Calculate PageRank
# Implementation
import numpy as np
def calculate_pagerank(data, d=0.85):
matrix_m = np.matrix(data)
assert matrix_m.shape[0] == matrix_m.shape[1]
n = matrix_m.shape[0]
matrix_i = np.zeros((n, n))
for pos in range(n):
@sqybi
sqybi / deploy_v2ray_ubuntu20.sh
Last active October 3, 2022 04:56
Deploy V2Ray on Ubuntu 20.04
#!/usr/bin/env bash
set -ex
#####################################
# Please run this script with ROOT! #
#####################################
### CONFIGS ###
@sqybi
sqybi / import.py
Created February 14, 2020 13:50
Import Overwatch statslab csv to MongoDB
#!/usr/bin/env python3
from pathlib import Path
import pymongo
DB_URL = 'mongodb://localhost:12345/' # Use your MongoDB URL
DATA_BASE_PATH = Path("../data/") # Your csv file should look like: ../data/2019/phs_2019_stage.csv
@sqybi
sqybi / gist:5263144
Created March 28, 2013 13:33
Convert RGB color (0-255) to HSL (h: 0-360; s, l: 0-1)
private Tuple<double, double, double> RgbToHsl(Tuple<int, int, int> rgb)
{
int r = rgb.Item1;
int g = rgb.Item2;
int b = rgb.Item3;
double h, s, l;
int max = Math.Max(r, Math.Max(g, b));
int min = Math.Min(r, Math.Min(g, b));
@sqybi
sqybi / gist:5263137
Created March 28, 2013 13:31
Convert HSL color (h: 0-360; s, l: 0-1) to RGB (0-255)
private Tuple<int, int, int> HslToRgb(Tuple<double, double, double> hsl)
{
double h = hsl.Item1;
double s = hsl.Item2;
double l = hsl.Item3;
int r = 0, g = 0, b = 0;
double q, p, hk, t, c;
// set q