Skip to content

Instantly share code, notes, and snippets.

@nalf3in
nalf3in / ubuntu-20.04-wsl2.ps1
Created January 27, 2022 15:54 — forked from djfdyuruiry/ubuntu-20.04-wsl2.ps1
Ubuntu 20.04 in WSL 2
## change to your username
$user="wsl-user"
# download latest 20.04 release
curl --location `
--remote-name `
"https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64-wsl.rootfs.tar.gz"
# import into WSL 2
wsl --import `
@nalf3in
nalf3in / pdf_to_searchabled_pdf.py
Last active October 17, 2020 19:35
Script to convert unsearchable pdf to a searchable one using tesseract (I should be studying instead of making this)
#TESSERACT NEEDS TO BE INSTALLED FOR THIS TO WORK
# %%
#Imports
import os
import fitz
import pytesseract
# %%
#Create dirs if necessary
IMG_OUT_FOLDER = "tmp/imgs/"
@nalf3in
nalf3in / disabler.py
Last active August 21, 2020 19:00
Python script to disable/enable game profiles in GHub
# Assuming GHub is installed at it's default location
# %%
import os
import json
CONFIG_FILE_PATH = "C:/Users/Jonathan/AppData/Local/LGHUB/settings.json"
LG_HUB_EXE_PATH = "C:/Program Files/LGHUB/lghub.exe"
ENABLE_GAME_PROFILES = False
# %%
@nalf3in
nalf3in / beatsaber_folder_renamer.py
Last active July 8, 2020 22:34
Quick script to rename beatsaber songs folders to something a bit better
import os
import shutil
import json
import traceback
import time
from datetime import datetime
import tkinter as tk
from tkinter import filedialog
# If this is true, overwrite an folder with the same name if the other one is newer
@nalf3in
nalf3in / FileUploader.java
Last active July 2, 2020 20:57
Little class to upload a binary file to an http server
import java.io.BufferedInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Reader;
import java.net.HttpURLConnection;
@nalf3in
nalf3in / photosBackuper.py
Last active July 2, 2020 16:25
Script to backup your Android phone photos, requires adb to be in your path
import subprocess
import os
DEVICE = "10.0.0.4:5555"
SEPARATOR = "---------------"
subprocess.run(["adb", "devices"], stdout=subprocess.DEVNULL)
subprocess.run(["adb", "connect", DEVICE], stdout=subprocess.DEVNULL)
subprocess.run(["echo", SEPARATOR], shell=True, stdout=subprocess.DEVNULL)
shell_output = subprocess.run(["adb", "shell", "ls -1 /sdcard/dcim/camera"], capture_output=True, text=True)