Skip to content

Instantly share code, notes, and snippets.

@Nachtalb
Nachtalb / col_print.py
Last active February 9, 2018 14:48 — forked from critiqjo/col_print.py
Python: Multi-column printing of a list of strings
def col_print(lines, term_width=None, indent=0, pad=2):
"""Print list of strings in multiple columns
Original: https://gist.github.com/critiqjo/2ca84db26daaeb1715e1
Adjusted: https://gist.github.com/Nachtalb/8a85c0793b4bea0a102b7414be5888d4
"""
if not term_width:
size = shutil.get_terminal_size((80, 20))
term_width = size.columns
@Nachtalb
Nachtalb / search.html
Created April 12, 2019 21:27
Example Google image search for "Nachtalb"
<!doctype html>
<html itemscope="" itemtype="http://schema.org/SearchResultsPage" lang="de-CH">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<meta content="/images/branding/googleg/1x/googleg_standard_color_128dp.png" itemprop="image">
<title>Nachtalb - Google-Suche</title>
<style>#gb {
font: 13px/27px Arial, sans-serif;
height: 30px
}
@Nachtalb
Nachtalb / install.sh
Last active June 30, 2019 11:16
Centos 6 - Init.d - Install Sonarr / Radarr / Lidarr + mono + sqlite
#!/bin/sh
# # # # # # # # # # # # # # #
# Install yum prerequisites #
# # # # # # # # # # # # # # #
echo "--------------------------------------------------------------------------------------------"
echo "Starting the installation of Sonarr + Mono + SQLitee."
echo "--------------------------------------------------------------------------------------------"
sleep 5
# Install EPEL & OpenSuse repository
@Nachtalb
Nachtalb / check_torrent_size.py
Created July 26, 2019 20:39
Check total size of all torrents recursively in a dir
from pathlib import Path
# Install https://pypi.org/project/bencode.py/
# $ pip install bencode.py
import bencode
total_bytes = 0
files = list(Path().rglob('*.torrent'))
total_files = len(files)
print('Getting file sizes')
#!/bin/sh
# Update latest epel
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -Uvh epel-release-6-8.noarch.rpm
# Install forenscis tools repository for protobuf-compiler and protobuf-devel
wget https://forensics.cert.org/cert-forensics-tools-release-el6.rpm
rpm -Uvh cert-forensics-tools-release-el6.rpm
# Install openfusion repository for perl-IO-Socket-IP
wget http://repo.openfusion.net/centos6-i386/openfusion-release-0.7-1.of.el6.noarch.rpm
@Nachtalb
Nachtalb / danbooru.py
Last active October 25, 2021 16:00
IRC ZNC module for posting danbooru pics on demand by any user with configurable commands for each IRC channel
from contextlib import contextmanager
from datetime import datetime
from random import choice
from requests import Session
from yarl import URL
import inspect
import json
import os
import pprint
import sys
@Nachtalb
Nachtalb / channel_vids_to_csv.py
Last active November 1, 2021 19:51
Get all videos of a youtube channel and print url, title and publish date as CSV
# Ya need to install "yarl" and "requests" cuz I was too lazy to use the standard libs
from yarl import URL
from requests import Session
key = "YOUTUBE_API_KEY"
channel_id = "CHANNEL_ID"
url = f"https://www.googleapis.com/youtube/v3/search"
query = {
@Nachtalb
Nachtalb / quick_ffmpeg_explorer.py
Last active November 1, 2021 20:10
Create windows explorer ffmpeg context menu entries
# 1. Change paths in the "template" variable, be sure to have to correct number of backslashes
# 2. python quick_ffmpeg_explorer.py > quick_ffmpeg_explorer.reg
# 3. Double click the "quick_ffmpeg_explorer.reg" file
import re
structure = {
'00_FFMPEG': {
'keys': { 'SubCommands': '', 'MUIVerb': 'FFMPEG' },
'folders': {
@Nachtalb
Nachtalb / pihole_to_hosts.py
Last active January 24, 2022 21:48
Pihole addlists (and custom blacklist) to hosts file (also removes duplicates)
#!/usr/bin/env python
#
# Convert pihole domain blacklists to hosts file format.
#
# Usage:
# Create folder ./export
# Create pihole export and extract it to ./export
# Backup can be created in "Settings" > "Teleporter" > "Backup"
# Install requirements with "pip install aiohttp[speedups] tqdm"
# Run script "python pihole_to_hosts.py"
[Desktop Entry]
Version=1.0
Name=Telegram Instance X
Comment=Official desktop version of Telegram messaging service
TryExec=/opt/Telegram/Telegram
Exec=/opt/Telegram/Telegram -workdir /home/kali/.local/share/TelegramDesktop/instance_X -- %u
Icon=telegram
Terminal=false
StartupWMClass=TelegramDesktop
Type=Application