Skip to content

Instantly share code, notes, and snippets.

View 4piu's full-sized avatar
ROLLING BACK

4piu 4piu

ROLLING BACK
View GitHub Profile
@4piu
4piu / Logger.py
Created October 16, 2019 11:42
Python colored logger
import logging
import platform
import sys
# logger config
LOG_LEVEL = logging.DEBUG
LOG_FORMAT = "\x1b[0;90m[%(asctime)s.%(msecs)03d] \x1b[0;90m(%(threadName)s) \x1b[1;37m%(levelname)s\x1b[0;90m: %(message)s"
LOG_DATE_FORMAT = "%Y-%m-%d %H:%M:%S"
LOG_FILE = ''
@4piu
4piu / tar2zip.sh
Created October 16, 2019 15:39
Convert tar to zip
#!/bin/bash
# Warning! /tmp is used to store the extracted file
TMP='/tmp/tar2zip/'
IFS=$(echo -en "\n\b")
if [ $# == 0 ]
then
set -- `ls *.{tar,gz,gz2,bz,bz2,Z} 2> /dev/null`
fi
@4piu
4piu / FlyDoublePinyin.reg
Created October 18, 2019 09:56
Add fly double pinyin scheme to Windows 10 Micropsoft Pinyin
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\InputMethod\Settings\CHS]
"UserDefinedDoublePinyinScheme0"="Fly*2*^*iuvdjhcwfg^xmlnpbksqszxkrltvyovt"
@4piu
4piu / Enable ReFS.reg
Created October 18, 2019 09:57
Enable ReFS support on Window 10
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem]
"RefsDisableLastAccessUpdate"=dword:00000001
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\MiniNT]
"AllowRefsFormatOverNonmirrorVolume"=dword:00000001
@4piu
4piu / Windows UTC Time
Created October 18, 2019 10:01
Make Windows use UTC time to avoid time offset under dualboot system
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation]
"RealTimeIsUniversal"=dword:00000001
@4piu
4piu / JetbrainsIconFix.sh
Last active October 25, 2019 07:57
This script converts and changes the Jetbrains app icons in desktop file to png, in order to fix missing icon in the Application laucher of KDE Plasma
#!/bin/bash
# This script converts and changes the Jetbrains app icons to png in order to fix missing icon in the Application laucher of KDE Plasma
IFS=$(echo -en "\n\b")
DESKTOP=~/.local/share/applications/jetbrains-*.desktop
if ! [ -x "$(command -v convert)" ]; then
echo 'Error: ImageMagick is not installed. ' >&2
exit 1
fi
@4piu
4piu / Typoman_helper.py
Created January 4, 2020 08:08
Typoman word spell helper. Find all possible combinations.
import argparse
import re
#https://github.com/first20hours/google-10000-english/blob/master/google-10000-english.txt
dictionary = "google-10000-english.txt"
parser = argparse.ArgumentParser(description='Find all words with specific letters')
parser.add_argument('letters', metavar='L', type=str, nargs='+',
help='array of letters like \'A\' \'B\' \'C2\', the number after letter limit the occurrence')
args = parser.parse_args()
@4piu
4piu / khinsider_batch.py
Created January 4, 2020 08:16
Batch create download task for khinsider using csv. https://github.com/obskyr/khinsider
#!/usr/bin/env python
# https://github.com/obskyr/khinsider
# csv format
# "album forder name", "album-id", " ext1,ext2"
# example
# "Dance Dance Revolution - Disney Eurobeat - Disc 1","dance-dance-revolution-disney-eurobeat-disc-1","flac"
# "Dance Dance Revolution - Disney Eurobeat - Disc 2","dance-dance-revolution-disney-eurobeat-disc-2","mp3"
@4piu
4piu / error.html
Last active April 26, 2020 04:38
Windows 10 BSoD Theme Error Page
<!--
Example config for Nginx:
server {
# ...
error_page 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 420 422 423 424 426 428 429 431 444 449 450 451 500 501 502 503 504 505 506 507 508 509 510 511 /error.html;
location /error.html {
ssi on;
internal;
auth_basic off;
@4piu
4piu / raid-sleep.sh
Last active March 27, 2023 01:55
Unmount zpool and spin down HDDs
#!/bin/bash
# unmount zpool and issue sleep command to HDDs
if [[ $EUID > 0 ]]; then
echo "ERROR: Please run as root"
exit 1
fi
if ! [ -x "$(command -v hdparm)" ]; then