Skip to content

Instantly share code, notes, and snippets.

@TestItOnlyOnce
TestItOnlyOnce / wuxscrap.py
Last active March 1, 2019 18:02
HTML scrapper for wuxiaworld novels (Python)
import os, subprocess, sys, requests, re
from time import sleep
from collections import OrderedDict
from os.path import expanduser
from bs4 import BeautifulSoup as bs
from natsort import humansorted, natsorted
BASE_URL = "https://www.wuxiaworld.com"
HEADERS = {'User-Agent': 'Mozilla/5.0 (rv:66.0) Gecko/20100101 Firefox/66.0'}
@TestItOnlyOnce
TestItOnlyOnce / patch.ps1
Created January 11, 2019 16:43
Binary PowerShell patcher (fc /b format); Бинарный патчер [codepage: win-1251]
<#
.КАК ИСПОЛЬЗОВАТЬ
0. Разрешите локальные скрипты вбив set-executionpolicy remotesigned в консоли PowerShell ISE или
запустив скрипт как powershell -executionpolicy bypass -File "patcher.ps1".
1. Скопируйте .fix файл в папку с пропатчиваемой программой.
2. Запустите этот скрипт.
3. Укажите путь к .fix файлу.
Всё...
@TestItOnlyOnce
TestItOnlyOnce / replace.py
Last active January 11, 2019 13:10
RegExp find and replace string in all matching files and subdirectories (recursive)
#------------------------------------------------------------------------------
# Filename: replace.py
# Purpose: RegExp find and replace string in all matching files and current subdirectories (recursive)
# Usage: python FindAndReplace.py "[Old Regexp]" "[New String]"
# [File Filters(ex/default: ".c,.cc,.h"")] [Working Directory]
# Requirement: Files must be text (non-binary) and not very large.
# WARNING: This script will OVERWRITE files matching [File Filters].
# All occurrences of [Old Regexp] will be replaced with [New String].
# Make sure you really, really want to do this!!!
#------------------------------------------------------------------------------
@TestItOnlyOnce
TestItOnlyOnce / trrprefs.md
Last active June 28, 2018 12:09 — forked from bagder/trrprefs.md
Preferences for the DNS-over-HTTPS functionality in Firefox 61+

Preferences

All preferences for the DNS-over-HTTPS functionality in Firefox are located under the "network.trr" prefix (TRR == Trusted Recursive Resolver). The support for these landed in Firefox 60 but will be polished further in 61.

network.trr.mode

set which resolver mode you want.

0 - Off (default). use standard native resolving only (don't use TRR at all)

1 - Race native against TRR. Do them both in parallel and go with the one that returns a result first.

@TestItOnlyOnce
TestItOnlyOnce / goslate.py
Last active January 12, 2018 12:31
Goslate: Free Google Translate API (query hash function version to comply with GT site expectations)
#! /usr/bin/env python
# -*- coding: utf-8 -*-
'''
--------------------------------------
Goslate: Free Google Translate API
--------------------------------------
'''
from __future__ import print_function
@TestItOnlyOnce
TestItOnlyOnce / pdftitle.py
Last active March 23, 2022 03:30 — forked from hanjianwei/pdftitle.py
Rename pdf files to their content's titles (for Python 3; with wildcard support; default rename all pdfs)
#!/usr/bin/env python
"""
Extracts title from PDF files (Python 3).
Depends on: pdf, pyPDF2, PDFMiner3k, unidecode.
Usage:
pdftitle -d tmp --rename *.pdf{}
@TestItOnlyOnce
TestItOnlyOnce / gitam.cmd
Created August 11, 2017 15:20
How to apply several git patch files using a batch command file on windows?
@echo off
rem Copy all .patch.txt files to your repo root before applying.
rem You can delete them afterwards or add *.patch.txt to .gitignore.
for %%f in (*.patch.txt) do git am -3 --keep-cr --whitespace=nowarn "%%~f"