Skip to content

Instantly share code, notes, and snippets.

@kampfgnu
kampfgnu / mkvextractTracks.sh
Last active March 13, 2024 05:19
batch extract subtitles from mkv files
#!/bin/bash -e
# a script that extracts the subtitle file of every mkv movie file and saves it with the same name
# copy to the folder where the mkv files live and run "./mkvextractTracks.sh" in terminal
# options: [trackID]
# example: ./mkvextractTracks.sh 1
#
# info:
# mkvextract is used to extract the subtitles, so mkvtoolnix app (which contains the mkvextract binary) is used:
# https://mkvtoolnix.download/downloads.html
setTimeout(function(){debugger;}, 5000)
nvm install lts/* --reinstall-packages-from=node
objStringFromBufferGeometry: function (geom) {
var s = '';
var geometry = new THREE.Geometry().fromBufferGeometry( geom );
for (var i = 0; i < geometry.vertices.length; i++) {
var vertex = geometry.vertices[i];
s += 'v '+ vertex.x + ' ' + vertex.y + ' '+ vertex.z + '\n';
}
for (var i = 0; i < geometry.faces.length; i++) {
s += 'f '+ (geometry.faces[i].a+1) + ' ' + (geometry.faces[i].b+1) + ' ' + (geometry.faces[i].c+1);
@kampfgnu
kampfgnu / gist:06d978e18abcf4dedda7a80bdcae9144
Created December 8, 2020 11:32
display markdown from terminal
grip -b filename.md
@kampfgnu
kampfgnu / gist:5670865cb7fc94c4f803f06c27ba0cfe
Last active December 8, 2020 11:22
disk usage recursive list size sorted size ASC (the "/" after "*" is used to list folders only)
du -sh */ | sort -hr
@kampfgnu
kampfgnu / gist:8b75aadc449938588741827921627925
Created December 8, 2020 11:20
dump tables of a db to single files with hardcoded password
#!/bin/bash
# dump-tables-mysql.sh
# Descr: Dump MySQL table data into separate SQL files for a specified database.
# Usage: Run without args for usage info.
# Author: @Trutane
# Ref: http://stackoverflow.com/q/3669121/138325
# Notes:
# * Script will prompt for password for db access.
# * Output files are compressed and saved in the current working dir, unless DIR is
@kampfgnu
kampfgnu / resizer3x
Created May 15, 2016 09:22
batch resize @3x iOS image assets to @2x and @1x
#!/bin/bash -e
# batch resize @3x iOS image assets to @2x and @1x
# copy this script to the folder where the @3x images files live and run "./resizer3x.sh" in terminal.
# this will generate [filename]@2x.[extension] and [filename].[extension] images in the same folder
# Ensure we're running in location of script.
cd "`dirname $0`"
@kampfgnu
kampfgnu / convertPDFToPNG3x.sh
Created March 4, 2018 09:52
convert vector pdf to iOS image assets
#!/bin/bash -e
# convert vector pdf to iOS image assets
# copy this script to the folder where the pdf files live and run "./convertPDFToPNG3x.sh" in terminal.
# this will generate [filename]@3x.png, [filename]@2x.png and [filename].png images in the same folder
# Ensure we're running in location of script.
cd "`dirname $0`"
import os, time
from stat import * # ST_SIZE etc
from os import walk
import datetime
extensions = [".jpeg", ".jpg", ".png", ".mov", ".aae", ".mp4"]
files = []
for (dirpath, dirnames, filenames) in walk("./"):
files.extend(filenames)