Skip to content

Instantly share code, notes, and snippets.

View alexlaurence's full-sized avatar
🎌
Working on projects

Alexander Adam Laurence alexlaurence

🎌
Working on projects
View GitHub Profile
@alexlaurence
alexlaurence / MP4_to_Webm.sh
Created March 22, 2023 07:22
This is for those who play Clone Hero on Linux/Steam Deck and want Background Videos. Put this file on your parent folder, and run the shell script by running sh MP4_to_Webm.sh on Konsole.
for d in *; do
if [ -d "$d" ]; then # or: if test -d "$d"; then
( cd "$d" && ffmpeg -threads 16 -i video.mp4 -c:v libvpx -b:v 10M -c:a libvorbis video.webm && rm video.mp4)
fi
done
@alexlaurence
alexlaurence / RenameFiles.py
Created May 7, 2019 18:47
Batch rename files by appending an ascending index suffix
# Creates imagea.png, imageb.png, imagec.png -> imagea_1.png, imageb_2.png, imagec_3.png, etc.
path = '/my/folder/path'
files = os.listdir(path)
file_noext = file[:-4]
extension = '.png'
separator = '_'
print('Renaming...')
@alexlaurence
alexlaurence / AudioFromResources.cs
Last active December 31, 2018 00:36
[Unity3d Goodies] #Unity3d
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AudioFromResources : MonoBehaviour
{
static AudioClip audioClipName;
public static AudioSource audioSrc;
void Start ()
@alexlaurence
alexlaurence / Database.sql
Last active December 14, 2018 03:26
[SAC Snippets] #Unity3d
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
CREATE TABLE `tableName`
(
`columnName` varchar(40) NOT NULL
)
ENGINE=MyISAM DEFAULT CHARSET=utf8;
class FloydWarshell
{
// Recursive Function to print path of given
// vertex u from source vertex v
private static void printPath(int[][] path, int v, int u)
{
if (path[v][u] == v)
return;
printPath(path, v, path[v][u]);
import java.util.*;
// Data structure to store graph edges
class Edge
{
int source, dest, weight;
public Edge(int source, int dest, int weight) {
this.source = source;
this.dest = dest;
import java.util.*;
// Data structure to store graph edges
class Edge
{
int src, dest, weight;
public Edge(int src, int dest, int weight) {
this.src = src;
this.dest = dest;
import java.util.*;
// class to represent a disjoint set
class DisjointSet
{
private Map<Integer, Integer> parent = new HashMap();
// stores the depth of trees
private Map<Integer, Integer> rank = new HashMap();
import java.util.*;
// Data structure to store graph edges
class Edge
{
int source, dest;
public Edge(int source, int dest) {
this.source = source;
this.dest = dest;
import java.util.Arrays;
// Data structure for Max Heap
class HeapSort
{
// return left child of A[i]
private static int LEFT(int i) {
return (2 * i + 1);
}