Skip to content

Instantly share code, notes, and snippets.

View oskarsh's full-sized avatar
🐢
interested in life and other forms of art

oskar oskarsh

🐢
interested in life and other forms of art
View GitHub Profile
@oskarsh
oskarsh / sort_images_by_aspect_ratio.sh
Created April 11, 2023 07:59
This sorts all images that are not 1x1 aspect ratio and puts them in the widescreen folder. Make sure to change the image_direcory
#!/bin/bash
# Set the working directory with the images
image_directory="/home/Pictures/Stålenhag"
cd "$image_directory"
mkdir 'widescreen'
# Iterate over all jpg files in the directory
find . -iname "*.jpg" | while read -r image; do
@oskarsh
oskarsh / debugHeaders.py
Created March 9, 2023 20:03
This gist provides a simple http route on localhost:4000/test/ printing out the headers and the payload. Used for debugging only
from http.server import BaseHTTPRequestHandler, HTTPServer
from urllib.parse import urlparse
class RequestHandler(BaseHTTPRequestHandler):
def do_POST(self):
# Parse the request URL
parsed_path = urlparse(self.path)
print(parsed_path)
# Check if the requested URL is /test
@oskarsh
oskarsh / Extract.html
Created February 8, 2023 12:06
Extracts from a given svg file the path data and lets you copy it quickly.
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SVG Path Extractor</title>
<style>
body {
display: flex;
@oskarsh
oskarsh / HiseSliderMod.js
Created October 27, 2022 13:51
Adds a easily moddable vector slider for hise.
const laf = Engine.createGlobalScriptLookAndFeel();
const BORDER = 3;
const PADDING = 10;
const GLOW_RING_SIZE = 3;
const GLOW_AMOUNT = 3;
const BLACK = '0x000000';
const RED_COLOUR = '0xFBFF0000';
const BLUE_COLOUR = '0xFB0023FF';
const BORDER_COLOR = '0xDFDFDF';
@oskarsh
oskarsh / setup.sh
Last active November 21, 2019 06:25
Setup Solus for Development
sudo eopkg upgrade
sudo eopkg install docker zsh docker-compose vscode nodejs
sudo eopkg install -c system.devel
sudo systemctl enable docker
sudo systemctl start docker
sudo usermod -aG docker daeh
@oskarsh
oskarsh / folder_file_infos.py
Created May 8, 2019 21:07
[getting each file inside a folder with extension]
index = [y for x in os.walk(base_path) for y in glob(os.path.join(x[0], '*.jpg'))]
@oskarsh
oskarsh / colorized_print.sh
Created April 27, 2019 15:41
[colorize terminal output]
# Colourise the output
YEL='\033[1;33m' # Yellow
NCL='\033[0m' # No Color
RED='\033[0;31m' # REDs
printf "%*s\WITH THE NAME:\t${YEL}%s${NCL}\n" $((indent+4)) '' "$name.mp3"
@oskarsh
oskarsh / check_if_file_exists.sh
Created April 27, 2019 12:15
Checks a directory if a file exists
find $directory_path -name $file_name | wc -l
@oskarsh
oskarsh / get_ssh_output.py
Last active April 26, 2019 19:01
[run commands on ssh machine] runs a command on a device connected with ssh and gets output
#definde ssh
ssh_connection="root@189.232.123.XX"
password="admin"
sshpass -p $password ssh $ssh_connection #":command here:"
#ls command
ssh_connection="root@189.232.123.XX"
password="admin"
command="ls"
#sudo vi /etc/udev/rules.d/90-xhc_sleep.rules
# disable wake from S3 on XHC1
SUBSYSTEM=="pci", KERNEL=="0000:00:14.0", ATTR{power/wakeup}="disabled"