Skip to content

Instantly share code, notes, and snippets.

View Dylancyclone's full-sized avatar

Dylan Lathrum Dylancyclone

View GitHub Profile
@Dylancyclone
Dylancyclone / .js
Created March 25, 2019 07:21
.srt to .json
var regBlock = /^[0-9]+\n(.+\n)+/gm; //Use /^\n(.+\n)+/gm if there are no leading sequence numbers
var regText = /^[0-9]+\n(.+\n)/gm; //Use /^\n(.+\n)/gm if there are no leading sequence numbers
var regTime = /[0-9:]{2}:[0-9]{2}:[0-9]{2},[0-9]{3} --> [0-9:]{2}:[0-9]{2}:[0-9]{2},[0-9]{3}/gm;
var result;
final = [];
while((result = regBlock.exec(text)) !== null) {
while((resultTime = regTime.exec(result[0])) !== null) {
start = resultTime[0].split(" --> ")[0];
end = resultTime[0].split(" --> ")[1];
@Dylancyclone
Dylancyclone / AnimatedHairToCurve.py
Last active May 12, 2020 03:27
This is a small blender script to convert simulated hair particles into a series of curves that have a bevel applied to them. This script was used for this project: https://youtu.be/rIxeJ6HQrrE
import bpy
depsgraph = bpy.context.evaluated_depsgraph_get()
object = bpy.data.objects['Source'] # Object that has the hair simulation
taper = bpy.data.objects['Taper'] # Curve each generated curve object should use as a taper
particles_coll = bpy.data.collections.new(name="particles")
bpy.context.scene.collection.children.link(particles_coll)
start_frame = bpy.context.scene.frame_start
end_frame = bpy.context.scene.frame_end
for frame in range(start_frame, end_frame + 1):
@Dylancyclone
Dylancyclone / clearCustomSplitNormalsData.py
Last active August 1, 2024 07:06
Blender script to clear all Custom Split Normal Data from selected objects. Simply select all the objects and run the script. This is useful when importing a bunch of objects used in game development, such as the output generated from https://github.com/Dylancyclone/VMF2OBJ/
import bpy
selection = bpy.context.selected_objects
for o in selection:
try:
bpy.context.view_layer.objects.active = o
bpy.ops.mesh.customdata_custom_splitnormals_clear()
except:
print("Object has no custom split normals: " + o.name + ", skipping")
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"alignment": "right",
"segments": [
{
"background": "#292929",
"foreground": "#fb7e14",
"leading_diamond": "\ue0b6",
@Dylancyclone
Dylancyclone / .bashrc
Last active January 3, 2023 22:46
Display git repo info on browse using `o2sh/onefetch`
LAST_REPO=""
cd() { builtin cd "$@" git rev-parse 2>/dev/null
if [ $? -eq 0 ]; then
if [ "$LAST_REPO" != $(basename $(git rev-parse --show-toplevel)) ]; then
onefetch
LAST_REPO=$(basename $(git rev-parse --show-toplevel))
fi
fi
}
@Dylancyclone
Dylancyclone / followalldockerlogs.sh
Created January 31, 2023 23:08
Follow all docker container logs with container name
docker ps --format='{{.Names}}' | xargs -P0 -d '\n' -n1 sh -c 'docker logs "$1" --follow | sed "s/^/$1: /"' _
@Dylancyclone
Dylancyclone / pullAllGitBranches.sh
Created February 3, 2023 22:40
pull and track all remote Git branches
git branch -a | grep -v HEAD | perl -ne 'chomp($_); s|^\*?\s*||; if (m|(.+)/(.+)| && not $d{$2}) {print qq(git branch --track $2 $1/$2\n)} else {$d{$_}=1}' | csh -xfs
@Dylancyclone
Dylancyclone / zendesk_export.py
Created December 5, 2023 17:30
Exports every KB article from zendesk into text documents
import os
import datetime
import csv
import requests
from bs4 import BeautifulSoup
zendesk = "https://[endpoint].zendesk.com"
language = "en-us"
@Dylancyclone
Dylancyclone / lrcget.py
Last active July 21, 2024 13:24
MusicBrainz Picard LRCLIB Lyrics Plugin
from functools import partial
from urllib.parse import (
quote,
urlencode,
)
from PyQt5.QtNetwork import QNetworkRequest
from picard import config, log
from picard.metadata import register_track_metadata_processor