Skip to content

Instantly share code, notes, and snippets.

View ScribbleGhost's full-sized avatar

ScribbleGhost ScribbleGhost

View GitHub Profile
@ScribbleGhost
ScribbleGhost / LinksToBookmarks.py
Last active January 30, 2024 14:18
Got a long list of links you want to add as favorites in your web browser? Use this Python script to convert a CSV file with links to a favorite HTML file that can be imported to any Chromium browsers.
import csv
import html
def csv_to_html_bookmarks(csv_file_path, html_file_path):
header = '''<!DOCTYPE NETSCAPE-Bookmark-file-1>
<!-- This is an automatically generated file.
It will be read and overwritten.
DO NOT EDIT! -->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<TITLE>Bookmarks</TITLE>
@ScribbleGhost
ScribbleGhost / Force close programs in Windows.md
Last active December 12, 2023 13:01
Force close programs in Windows

Option 1: Use the name of the program

Stop-Process -Name "Adobe Desktop Service" -force

Option 2: Use the path of the program

Get-Process | Where-Object { $_.Path -eq "C:\Program Files\Common Files\Adobe\Creative Cloud Libraries\CCLibrary.exe" } | Stop-Process -Force
@ScribbleGhost
ScribbleGhost / BlockMultipleProgramsInWindowsFirewall.ps1
Last active December 27, 2023 19:24
Block multiple programs in Windows firewall by adding inbound and outbound rules. ⚠ Run as admin in Powershell. Read the description thoroughly ❗
<#
.SYNOPSIS
This script blocks multiple programs by adding them to the Windows Firewall both as inbound and outbound rules.
It also checks if a rule is already made. If it exists it will remove it and replace it with the new.
.NOTES
1. List of the programs you want to block in Windows Firewall in $programs.
2. Remember quotation marks and a comma at the last program in the list.
3. You can change the rule names by changing ruleNameInbound and ruleNameOutbound.
@ScribbleGhost
ScribbleGhost / autounattend.xml
Created November 4, 2023 15:50
My Windows 11 answer file
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State">
<!--
Selects Windows 11 Pro version with a generic key.
Step 1: You have to select which drive to install on. This is a good thing so that Windows does not wipe your drives randomly.
Step 2: Boots into "Who's going to use this device?". You jst enter a username and a password (you can skip the password by leaving it blank).
Then boots into the user account.
-->
<settings pass="offlineServicing"></settings>
<settings pass="windowsPE">
@ScribbleGhost
ScribbleGhost / My Windows 11 customization script
Created November 4, 2023 15:49
My Windows 11 customization script
REM ----------------------------------------------------------------------------------------------------------
REM ### Apps and app suggestions
REM ----------------------------------------------------------------------------------------------------------
REM TITLE: Turn Off Automatic Installation of Suggested Apps in Windows 10
REM LINK: https://www.tenforums.com/tutorials/68217-turn-off-automatic-installation-suggested-apps-windows-10-a.html
REM OPTIONS: 0x00000001=On, 0x00000000=Off
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /V "SilentInstalledAppsEnabled" /T "REG_DWORD" /D "0x00000000" /F 1>NUL 2>&1
@ScribbleGhost
ScribbleGhost / gifmaker.py
Last active August 28, 2023 12:18
Generate GIFs from either PNG image sequences or video files.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Script to generate GIFs from PNG sequences, video files, or folders containing PNGs.
Requirements:
- FFmpeg and Gifski in PATH.
Usage:
1. Drag and drop files/folders onto this script.
2. Follow the on-screen instructions.
@ScribbleGhost
ScribbleGhost / Downmix two stereo tracks in the video to one audio file.bat
Created January 26, 2023 10:10
Downmix two stereo tracks in the video to one audio file
ffmpeg -i %input% -vn -filter_complex amix=inputs=2:duration=longest -ac 2 -c:a libfdk_aac -cutoff 20000 -afterburner 1 -vbr 0 output.m4a
@ScribbleGhost
ScribbleGhost / Generate 34 GB of random data.ps1
Created January 26, 2023 10:09
Generate 34 GB of random data
for ($i=1; $i -le 34; $i++){$out = new-object byte[] 1073742000; (new-object Random).NextBytes($out);[IO.File]::WriteAllBytes("random_data_file$i.txt", $out)}
@ScribbleGhost
ScribbleGhost / Get the overall video bit rate of multiple video files.py
Last active November 22, 2022 08:34
Scanning through a folder recursively to detect the overall bit rate of video files with a certain extension.
import ffmpeg # pip install ffmpeg-python (not to be cinfused with python)
import psutil # pip install psutil (might require wheels, which might be incompatible with versions above Python 3.9)
import os
import glob
import csv
# The path in which you would like to look for video files
directory = 'M:\VIDEO\MOVIES'
# The file types you want to check
@ScribbleGhost
ScribbleGhost / Adding (attaching) pictures or images to MP3 files with the mutagen library in Python 3.py
Created September 22, 2022 08:06
Adding (attaching) pictures or images to MP3 files with the mutagen library in Python 3
from mutagen.mp3 import MP3
from mutagen.id3 import ID3, APIC
audio_path = 'sample_original - Copy.mp3'
audio = MP3(audio_path, ID3=ID3)
# Remember to change to image/jpeg if JPG or image/png if PNG.
# https://mutagen-specs.readthedocs.io/en/latest/id3/id3v2.4.0-frames.html#attached-picture
# Remember that no description should be similar.