Skip to content

Instantly share code, notes, and snippets.

View SonGokussj4's full-sized avatar

SonGokussj4 SonGokussj4

View GitHub Profile
@SonGokussj4
SonGokussj4 / prowlarr.trace.txt
Created March 10, 2024 15:30
Prowlarr Trace SkTorrent HTTP Request Failed
2024-03-10 16:28:03.8|Trace|DiskProviderBase|Deleting file: /config/logs/prowlarr.debug.txt
2024-03-10 16:28:03.8|Trace|CommandQueueManager|Updating command status
2024-03-10 16:28:03.9|Trace|EventAggregator|Publishing CommandUpdatedEvent
2024-03-10 16:28:03.9|Trace|EventAggregator|CommandUpdatedEvent -> CommandController
2024-03-10 16:28:03.9|Trace|EventAggregator|CommandUpdatedEvent <- CommandController
2024-03-10 16:28:03.9|Trace|EventAggregator|Publishing CommandExecutedEvent
2024-03-10 16:28:03.9|Trace|EventAggregator|CommandExecutedEvent -> TaskManager
2024-03-10 16:28:03.9|Trace|EventAggregator|CommandExecutedEvent <- TaskManager
2024-03-10 16:28:03.9|Trace|EventAggregator|CommandExecutedEvent -> TaskController
2024-03-10 16:28:03.9|Trace|EventAggregator|CommandExecutedEvent <- TaskController
@SonGokussj4
SonGokussj4 / convert_IP_to_CIDR.py
Last active November 2, 2022 15:32
Convert IP address data in csv to CIDR format
"""
Change IP to CIDR (ignore second IP) and export to CSV
Usage:
python3 main.py <source_file>
Example data:
<source_file>:
1.0.174.0,1.0.174.255,AS,TH,"Nakhon Si Thammarat","Phra Phrom",8.33911,99.9009
1.0.78.0,1.0.78.255,AS,JP,Hiroshima,Hiroshima,34.4002,132.475
transfer() {
if [ $# -eq 0 ]; then
echo -e "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"
return 1
fi
tmpfile=$( mktemp -t transferXXX )
if tty -s; then
basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g')
curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile
else
@SonGokussj4
SonGokussj4 / replace_in_place.py
Last active March 10, 2020 22:20
Python - replace text inplace in file
# cat $HOME/my_file.txt
# Hi there
# This is a second line
# And third with text_to_replace string
import fileinput
from pathlib import Path
filepath = Path.home() / my_file.txt
with fileinput.FileInput(str(filepath.resolve()), inplace=True) as f:
@SonGokussj4
SonGokussj4 / crlf.py
Created April 18, 2019 10:27 — forked from jonlabelle/crlf.py
Replace CRLF (windows) line endings with LF (unix) line endings in files.
#!/usr/bin/env python
"""Replace line breaks, from one format to another."""
from __future__ import print_function
import argparse
import glob
import os
import sys