Skip to content

Instantly share code, notes, and snippets.

@kurohai
kurohai / aria2.conf
Created April 13, 2022 09:39 — forked from qzm/aria2.conf
Best aria2 Config
### Basic ###
# The directory to store the downloaded file.
dir=${HOME}/Downloads
# Downloads the URIs listed in FILE.
input-file=${HOME}/.aria2/aria2.session
# Save error/unfinished downloads to FILE on exit.
save-session=${HOME}/.aria2/aria2.session
# Save error/unfinished downloads to a file specified by --save-session option every SEC seconds. If 0 is given, file will be saved only when aria2 exits. Default: 0
save-session-interval=60
# Set the maximum number of parallel downloads for every queue item. See also the --split option. Default: 5
@kurohai
kurohai / Dockerfile
Created April 10, 2022 06:40 — forked from DamnWidget/Dockerfile
Anaconda docker composer example
FROM python:2.7
ADD . /code
WORKDIR /code
RUN pip install -r requirements.txt
CMD python app.py
@kurohai
kurohai / aria2jsonrpc.js
Created April 10, 2022 02:44 — forked from binux/aria2jsonrpc.js
aria2 jsonrpc client
var ARIA2 = (function() {
var jsonrpc_version = '2.0';
function get_auth(url) {
return url.match(/^(?:(?![^:@]+:[^:@\/]*@)[^:\/?#.]+:)?(?:\/\/)?(?:([^:@]*(?::[^:@]*)?)?@)?/)[1];
};
function request(jsonrpc_path, method, params) {
var request_obj = {
jsonrpc: jsonrpc_version,
@kurohai
kurohai / aria2-add.csx
Created April 10, 2022 02:44 — forked from jarek-przygodzki/aria2-add.csx
aria2 add download using JSON-RPC
/*
* scriptcs -install Newtonsoft.Json
* scriptcs -install CommandLineParser
*/
using System.Net;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
#!/usr/bin/env python3
# vim:fileencoding=utf-8
from datetime import datetime
from argparse import ArgumentParser, FileType
from concurrent.futures import ThreadPoolExecutor, as_completed
from subprocess import Popen, PIPE
import threading
import re
import shlex
import time
@kurohai
kurohai / rsync_backup.py
Created August 4, 2020 14:46 — forked from RoguePixel/rsync_backup.py
rsync wrapper scripts
#!/usr/bin/python
import sys, os, subprocess
##
##RSYNC-BACKUP V1
#the script can be executed and by defualt the variables specified in the script will used, otherwise arguments may be passed to the script at runtime. This script can be used to sync remote files to a local directory or local files to a remote direcory specified at runtime.
##
##
#argument examples:
#":~$ rsync-backup.py -raz user@host:/some/dir/ /some/dir"
#!/usr/bin/env python
"""
Uses rsync to sync files in parallel between a source and destination.
This script has been tested with Python 2.7.4 and 2.6.8; it requires 2.5+.
This script has also been tested with rsync versions 3.0.9 and 2.6.8.
BASIC USAGE:
@kurohai
kurohai / sync-it
Created August 4, 2020 14:43 — forked from playpauseandstop/sync-it
Additional wrapper to rsync command with profiles.
#!/usr/bin/env python
#
# Additional wrapper to ``rsync`` command with profiles.
#
# Requirements
# ============
#
# * Python_ 2.4 or higher
# * rsync_
#
  1. Download and pin books at https://read.amazon.com, and use epubor KCR converter to convert them into epubs.
  2. Download audio books at https://audible.com, with aax format.
  3. Obtain your activation bytes with the instruction of this post.
  4. Install ffmpeg with brew.
  5. Install audible-converter with npm. (File name will be extended automatically)
audible-converter "*.aax" -a <your-activation-bytes>
  1. Install atomicparsley with brew. (to add artwork to converted m4a files) Bash script to add artworks to m4a files:
@kurohai
kurohai / search.py
Created February 6, 2019 13:31 — forked from lmyyao/search.py
 via search engine or baidu engine spider
from __future__ import print_function
from bs4 import BeautifulSoup as bs
import requests
import logging
from itertools import count
import time
from blinker import signal
from lxml.html.clean import Cleaner
from lxml.html import tostring, fromstring, iterlinks
from selenium import webdriver