Skip to content

Instantly share code, notes, and snippets.

View the0demiurge's full-sized avatar
🙈
好孩子看不见

Charles Xu the0demiurge

🙈
好孩子看不见
View GitHub Profile
import os
import re
import zipfile
from collections import defaultdict
import bs4
def check_path(path, exist=True):
abspath = os.path.abspath(os.path.expanduser(path))
@the0demiurge
the0demiurge / ddns_provider.conf
Created November 28, 2020 13:00 — forked from superbob/ddns_provider.conf
Namecheap Synology DSM DDNS provider
#Insert this at the end of /etc.defaults/ddns_provider.conf
[Namecheap]
modulepath=/usr/syno/bin/ddns/namecheap.php
queryurl=https://dynamicdns.park-your-domain.com/update
@the0demiurge
the0demiurge / wenku8_txt2epub.py
Last active May 16, 2019 01:15
Convert wenku8 txt to epub
#!/usr/bin/env python2
from __future__ import print_function
import os
import pypub
import sys
if len(sys.argv) < 2:
print('usage: python', __file__, 'file')
exit()
# split txt
@the0demiurge
the0demiurge / incremental_lightgbm.py
Created December 27, 2018 09:14 — forked from goraj/incremental_lightgbm.py
incremental learning lightgbm
# -*- coding: utf-8 -*-
"""
@author: goraj
"""
import lightgbm as lgbm
from sklearn.datasets import load_digits
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.metrics import roc_auc_score
@the0demiurge
the0demiurge / dpt-notes-sync.py
Created December 4, 2018 08:28 — forked from jstvz/dpt-notes-sync.py
Automatic note download of Sony Digital Paper on Arch Linux
#!/usr/bin/env python3
"""
usage: dpt-notes-sync.py ip_address
"""
import datetime
import json
import os
from dateutil import parser as dateparser
@the0demiurge
the0demiurge / vps-init.sh
Last active April 10, 2018 09:03
vps重置之后安装所有所需软件,部署好ssr和nextcloud
#!/bin/bash
if [[ -z $TMUX ]]; then
echo 'must run in tmux'
apt update;apt install -y tmux
exit
fi
# Updating sources
read -p 'Updating packages(press Enter):'
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
echo "deb https://artifacts.elastic.co/packages/6.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-6.x.list
# initialization file (not found)
@the0demiurge
the0demiurge / namecheap-ddns
Last active November 17, 2020 04:01
Simple Namecheap Dynamic DNS client
#!/bin/sh
set -eu
FETCH="curl -sL"
# or for curl:
# FETCH="fetch -qo -"
# $1: Your domain
# $2: Subdomain A record to update. Use @ for TLD.
# $3: The password given to you by Namecheap's web interface
#
# Rerun this script every 5 minutes. Crontab entry:
@the0demiurge
the0demiurge / README.md
Last active December 22, 2019 10:45
把当前文件夹里面多个excel整合到一起

把当前文件夹里面多个类似的excel合并到一起,以"学号"的列进行排序,生成result.xlsx 用法为:把所有excel表与excel_concat.py放到一个文件夹,安装好python3与pandas之后,在命令行下使用cd命令到该文件夹,输入 python3 excel_concat.py

配置选项:

  • SHEETNAME: 指定excel表的sheet name,如果不指定则选取全部sheets
  • SKIPROWS: 跳过读取excel表的行数,用于跳过表的标题之类信息