Skip to content

Instantly share code, notes, and snippets.

View sixem's full-sized avatar

emy sixem

  • ザ・ファイブ・コーポレーション
  • 18:10 (UTC +02:00)
View GitHub Profile
@sixem
sixem / UUIDv4.java
Last active May 28, 2024 12:24
Simple UUIDv4 class in Java
import java.util.BitSet;
import java.security.SecureRandom;
public class UUIDv4 {
private static final boolean[] VERSION = new boolean[] {
false, true, false, false // Version 4
};
private static final boolean[] VARIANT = new boolean[] {
true, false // Variant
@sixem
sixem / hexbin.c
Created September 5, 2023 22:19
Basic decimal to binary in C
#include <stdio.h>
#include <stdlib.h>
int main() {
int decimal;
int *sequence = NULL;
int size = 0;
printf("Enter a decimal number: ");
scanf("%d", &decimal);
@sixem
sixem / mime.types
Created August 29, 2022 03:48
MIME types
# This file maps Internet media types to unique file extension(s).
# Although created for httpd, this file is used by many software systems
# and has been placed in the public domain for unlimited redisribution.
#
# The table below contains both registered and (common) unregistered types.
# A type that has no unique extension can be ignored -- they are listed
# here to guide configurations toward known types and to make it easier to
# identify "new" types. File extensions are also commonly used to indicate
# content languages and encodings, so choose them carefully.
#
@sixem
sixem / startLinuxDev1.bat
Created August 2, 2022 16:36
Starts a VM using qemu
"C:\Program Files\qemu\qemu-system-x86_64.exe" -smp 1 -m 512M -nographic ^
-hda "V:\VirtualMachines\qemuImages\LinuxDev1\linuxdev1.qcow2" ^
-nic user,hostfwd=tcp::8888-:22,hostfwd=tcp::8080-:9090
pause
@sixem
sixem / youtubeShortsRedirect.js
Created July 8, 2022 02:11
Redirects you away from the shorts page and to the actual video
// ==UserScript==
// @name Redirect from shorts page
// @namespace Violentmonkey Scripts
// @match https://www.youtube.com/*
// @grant none
// @version 1.0
// @author -
// @description 26/6/2022, 1:22:39 AM
// ==/UserScript==
@sixem
sixem / remove-recommended-channels.js
Last active March 10, 2022 11:39
Remove recommended channels from Twitch sidebar (Userscript)
@sixem
sixem / sequential-rename.sh
Created June 29, 2021 17:59
Sequential rename of files by index
#!/bin/bash
INDEX=0
find . -type f | while read FILE; do
BASENAME=$(basename "$FILE")
EXTENSION="${BASENAME##*.}"
FILENAME="${BASENAME%.*}"
echo "$FILENAME.$EXTENSION -> $INDEX.$EXTENSION"
@sixem
sixem / rm-by-dimensions.sh
Last active June 29, 2021 17:59
Remove image files under a certain width/height in bash
#!/bin/bash
LIMIT_W=300
LIMIT_H=300
find . -name '*.jpg' -o -name '*.png' -o -name '*.jpeg' | while read FILE; do
BASENAME=$(basename "$FILE")
IDENTIFY=$(identify "$BASENAME")
[[ "$IDENTIFY" =~ ([0-9]+)+x([0-9]+) ]]
@sixem
sixem / translateSrt.js
Last active June 26, 2021 15:37
Translates .srt files using Google Cloud (API)
/**
*
* npm install @google-cloud/translate srt-parser-2 yargs
*
* ======
* Usage:
* ======
*
* node translateSrt.js \
* --key 'google-cloud-project-key.json' \
@sixem
sixem / ytdl-subs.sh
Created June 25, 2021 15:22
Downloads a YouTube video with all the subtitles packed into a .mkv file
#!/bin/bash
# ======================================================================== #
# Downloads a YouTube video with all the subtitles packed into a .mkv file #
# ======================================================================== #
# Usage: ./ytdl-subs.sh "YOUTUBE_URL" "OUTPUT_NAME_WITHOUT_EXTENSION"
UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)