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 / location.js
Created June 30, 2017 07:51
Function for parsing URLs
window.parseURL=function(URL){
let [,schema="",host="",path="",search="",hash=""]=
URL.match(/^(?:(?:([^:]+:)?\/\/)?([^\/#?]+))?(?:(\/[^#?]*)?(\?[^#]*)?(#.*)?)?$/);
return {schema,host,path,search,hash}
}
@no1xsyzy
no1xsyzy / timetreeautolike.js
Created August 16, 2017 06:32
Automatically like all events in expanded day. Takes 4 secs for each event.
document.querySelectorAll(".dayEvents .span1").forEach((e,i)=>{
setTimeout(()=>{
e.click();
setTimeout(()=>{
document.querySelector(".like").click();
},1000)
setTimeout(()=>{
document.querySelector(".bouncePopupRoot").click();
},2000)
},i*4000)
@no1xsyzy
no1xsyzy / bamgumi2opedlist.js
Last active March 16, 2018 11:29
Bangumi to OPED list
all_highlight = document.querySelectorAll("div.table-right.data-list li.data-highlight div.title>span");
outputstring="";
for(i of all_highlight){
outputstring+="[ ] OP\t" + i.innerText+"\n";
outputstring+="[ ] ED\t" + i.innerText+"\n";
}
console.log(outputstring);
@no1xsyzy
no1xsyzy / dump.HAR.json
Created September 12, 2017 14:43
to report issue on Enhanced Steam about adding to wishlist from store page not working
{
"log": {
"version": "1.2",
"creator": {
"name": "WebInspector",
"version": "537.36"
},
"pages": [],
"entries": [
{
@no1xsyzy
no1xsyzy / demo.js
Created October 16, 2017 03:24
fetch demo for pms-final
fetch("http://118.31.185.146:5000/api/v1/optimization", {
method: "POST",
headers:{
"Content-Type":"application/json"
},
body:JSON.stringify(["9527","9528","9529"])
})
.then(x=>x.json())
.then(JSON.stringify)
.then(console.log)
console.clear();
s="";
document.querySelectorAll("input[type=text]:not(.ng-hide)")
.forEach(x=>{
if(x.value=="true" || x.value=="false")
s+=(x.parentElement.previousElementSibling.innerText+"\n")
});
console.log(s);
@no1xsyzy
no1xsyzy / Makefile
Created December 6, 2017 23:59
make list
.PHONY: list
list:
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null |\
awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' |\
sort |\
egrep -v -e '^[^[:alnum:]]' -e '^$@$$' |\
xargs
@no1xsyzy
no1xsyzy / ppt2pdf.py
Created February 5, 2018 15:29
A ppt2pdf converter. Only work on Windows with PowerPoint software installed. Licensed with Apache License, Version 2.0 (https://www.apache.org/licenses/LICENSE-2.0).
# Copyright [2018] [Siyuan "no1xsyzy" Xu]
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@no1xsyzy
no1xsyzy / wanke-crack-courseList.js
Last active May 17, 2018 19:00
Run with console in video page
// uses in console
// URL should be like <http://wanke001.com/User/Student/ClassIndex.aspx?ClassID=*&action=courseList>
var timelength = function(txt){
var [m, s] = txt.split(":");
return +m + (+s)/60;
}
var data = $$('section.PhaseDetaillist[contenttype="1"]')
.filter(x=>x.lastElementChild.firstElementChild.firstElementChild.firstElementChild)
.map(x=>([
@no1xsyzy
no1xsyzy / randomtest.py
Last active November 26, 2018 02:48
a test that tests random generating algorithm with an example
#!/usr/bin/env python3
import random
import math
def average(s):
s = list(s)
return sum(s)/len(s)
class randomtest:
_funs = []