Skip to content

Instantly share code, notes, and snippets.

@tigrouind
tigrouind / wipeout_tex_import.py
Created October 6, 2024 15:38
Import data from TEX file into TRS file (Wipeout XL/2097)
import struct
#copy TEX data into TRS
track_face_format = '4H 3h 2B I'
track_texture_format = '2B'
track_face_size = struct.calcsize(track_face_format)
track_texture_size = struct.calcsize(track_texture_format)
def update_track_face(track_face_file, track_texture_file, output_file):
@tigrouind
tigrouind / main.py
Created August 1, 2022 21:55
Synchronize subtitles of a given movie based on another movie
import cv2
import numpy
import math
import srt
import datetime
vidA = cv2.VideoCapture('movieA.mkv') #reference
vidB = cv2.VideoCapture('movieB.mkv') #to synchronize
with open('subtitles.srt', 'r') as f: #from fileA.mkv
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
namespace Test
{
class Program
{
static Random rand = new Random();
@tigrouind
tigrouind / sort.js
Last active March 5, 2019 14:48
move duplicate items next to each other
function sort(a) {
var n = a.length;
for (var j = 0; j < n - 2; j++) {
for (var i = j + 1; i < n; i++) {
if (a[i] == a[j]) {
//swap
if (a[i] != a[j + 1]) {
var tmp = a[j + 1];
a[j + 1] = a[i];
a[i] = tmp;