Skip to content

Instantly share code, notes, and snippets.

View Koswu's full-sized avatar

Kosmos X. Wu Koswu

View GitHub Profile
@Koswu
Koswu / switch_steam_account.cmd
Last active January 7, 2023 15:04
switch steam account
:: @echo off
taskkill /f /im steam.exe
taskkill /f /im SteamService.exe
:: replace [YOUR_USERNAME_HERE] with your real username
REG ADD HKEY_CURRENT_USER\SOFTWARE\Valve\Steam /v AutoLoginUser /t REG_SZ /d [YOUR_USERNAME_HERE] /f
:: replace steam path here
start "" "C:\Program Files (x86)\Steam\steam.exe"
@Koswu
Koswu / oj.py
Created January 28, 2022 03:41
online judge
class HashTable:
def __init__(self, size_):
self.size = size_
self.table = [[]] * size_
def hashkey(self, key):
hashval = 0
for ch in key:
hashval ^= ord(ch) % self.size
@Koswu
Koswu / ml.py
Last active March 21, 2021 07:52
机器学习聚类常用python头部import
import sklearn
from sklearn import datasets
from sklearn import svm
from matplotlib import pyplot as plt
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis as LDA
from sklearn.decomposition import PCA
from sklearn.neighbors import KNeighborsClassifier as KNN
from sklearn.manifold import SpectralEmbedding as SE
from sklearn.manifold import Isomap
from sklearn.manifold import LocallyLinearEmbedding as LLE
@Koswu
Koswu / indexpq.hpp
Last active March 15, 2021 06:20
indexpq
template <typename T> class IndexPQ{
private:
T *items;
int *pq;
int *qp;
size_t n;
size_t len;
void sink(int now){
int left = now*2;
int right = now*2+1;
<!DOCTYPE html>
<html>
<head>
<!-- Auther: KosWu-->
<!-- License: MIT -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>JUST VPN Helper V0.1</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.0/dist/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
@Koswu
Koswu / check_conn.cmd
Last active April 24, 2020 03:37
检查网络状况
@echo off
set /p gateway=输入你的网关地址(一般是192.168.1.1):
ping %gateway%
if %ERRORLEVEL%==1 goto GATEWAY_FAIL
if %ERRORLEVEL%==0 goto CHECK_DNS114
:GATEWAY_FAIL
echo 无法ping通网关,可能是与路由器的连接不对,请检查到路由器的连接
goto END
@Koswu
Koswu / install_nginx.sh
Last active March 22, 2020 08:08
CentOS7安装nginx并且配置HTTPS
yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
yum install -y nginx
wget https://dl.eff.org/certbot-auto
mv certbot-auto /usr/local/bin/certbot-auto
chown root /usr/local/bin/certbot-auto
chmod 0755 /usr/local/bin/certbot-auto
certbot-auto --nginx -d saikoworld.space
systemctl enable nginx
systemctl start nginx
echo "0 0,12 * * * root python -c 'import random; import time; time.sleep(random.random() * 3600)' && /usr/local/bin/certbot-auto renew -q" | sudo tee -a /etc/crontab > /dev/null
@Koswu
Koswu / md2hexo.py
Created March 4, 2020 12:07
将文章改为hexo格式
#!/usr/bin/python3
import time
import datetime
import os
import re
def main():
for filename in os.listdir('./'):
title, extension = os.path.splitext(filename)
@Koswu
Koswu / wuhan_test.py
Last active January 29, 2020 14:00
使用本福特定律检测武汉肺炎的确诊人数的真实性
# coding: utf-8
import json
import requests
import re
import math
import numpy as np
import matplotlib.pyplot as plt
plt.rcParams['font.family']=['SimHei']
plt.rcParams['axes.unicode_minus']=False
@Koswu
Koswu / activation.bat
Last active February 3, 2021 10:53
KMS 激活脚本
@echo off
::find key in https://py-kms.readthedocs.io/en/latest/Keys.html
set KEY=[YOUR_KEY]
set SERVER_IP=[YOUR_KMS_SERVER_IP]
set SERVER_PORT=[YOUR_KMS_SERVER_PORT Default:1688]
call:runslmgr /upk
call:runslmgr /ipk %KEY%
call:runslmgr /skms %SERVER_IP%:%SERVER_PORT%
call:runslmgr /ato
pause