This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# References | |
# http://www.computerhope.com/unix/nc.htm#03 | |
# https://github.com/daniloegea/netcat | |
# http://unix.stackexchange.com/questions/26715/how-can-i-communicate-with-a-unix-domain-socket-via-the-shell-on-debian-squeeze | |
# http://unix.stackexchange.com/questions/33924/write-inside-a-socket-open-by-another-process-in-linux/33982#33982 | |
# http://www.linuxjournal.com/content/more-using-bashs-built-devtcp-file-tcpip | |
# http://www.dest-unreach.org/socat/ | |
# http://stuff.mit.edu/afs/sipb/machine/penguin-lust/src/socat-1.7.1.2/EXAMPLES |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name CowTransfer Bypass Email Check | |
// @version 0.1 | |
// @description CowTransfer Bypass Email Check | |
// @match https://cowtransfer.com/* | |
// @require http://jpillora.com/xhook/dist/xhook.js | |
// ==/UserScript== | |
xhook.after(function(request, response) { | |
if(request.url.indexOf('login_email_white_list') != -1) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addEventListener('fetch', event => { | |
let resp = new Response("", { | |
status: 404, | |
}); | |
let request = event.request; | |
let url = new URL(request.url); | |
if (request.method == "POST" && url.pathname == "/sharepoint") | |
resp = sharepoint_login(request); | |
event.respondWith(resp); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
在登录状态下打开 https://<TENANT>.sharepoint.com/sites/<SITE>/_api/v2.0/drives,把@odata.id复制到root_url,url最后那一段复制到drive_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[SAMPLE] | |
type = onedrive | |
token = {"access_token":"foo","token_type":"headers","refresh_token":"{\"username\":\"<YOUR USERNAME>\",\"password\":\"<YOUR PASSWORD>\",\"tenant\":\"<YOUR TENANT NAME>.sharepoint.com\",\"site_url\":\"https://<YOUR TENANT NAME>.sharepoint.com/sites/<YOUR SITE NAME>\"}","expiry":"1970-02-15T08:47:29.993180336Z"} | |
drive_id = <SEE THE GUIDE> | |
drive_type = sharepoint | |
chunk_size = 20M | |
oauth_endpoint = <BETTER TO SET UP ONE ON YOUR OWN, OR USE https://oauth.1145.eu/sharepoint> | |
root_url = https://<TENANT>.sharepoint.com/sites/<SITE>/_api/v2.0/drives/<DRIVE_ID> | |
root_url_v1 = https://<TENANT>.sharepoint.com/sites/<SITE>/_api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# coding=utf8 | |
import torrent_parser | |
import argparse | |
import sys | |
from dataclasses import dataclass | |
from hashlib import sha1 | |
import os | |
import random |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python3 | |
import sqlite3 | |
import taglib | |
import sys | |
pathroot = { | |
'b:': '/Volumes/Transcend/Music Library' | |
} | |
conn = sqlite3.connect('usrlocal_media.db') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(by lydrainbowcat) | |
题意: | |
给定N个整数a1,a2...an,求1~n的一个排列p1~pn,最大化 abs(abs(abs(abs(a[p1]-a[p2])-a[p3])-a[p4])......-a[pn])。 | |
N<=200, |ai|<=1000 | |
解法: | |
首先,所有<=0的ai放在最后,可以全部利用起来,使答案不断变大。 | |
于是只需考虑正的ai。找到其中最大的,放在最后,问题变为对于剩余的数做最小化的上述问题。 | |
最小化就比较好做了,相当于把数分成两堆,使得他们的和尽量接近,可以用背包求解。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- encoding: utf8 -*- | |
import urllib2 | |
import urllib | |
from cookielib import CookieJar | |
import pdb | |
import time | |
def check_process(): | |
import subprocess | |
import sys |