Skip to content

Instantly share code, notes, and snippets.

View LudwikJaniuk's full-sized avatar

Ludvig Janiuk LudwikJaniuk

  • Oracle
  • Stockholm
View GitHub Profile
@LudwikJaniuk
LudwikJaniuk / add_ids_in_filenames.py
Created March 24, 2019 22:27
Add numerical ids to filename of every file in directory by renaming. Useful for zettelkasten.
import os
import sys
import re
from pathlib import Path
# Run: python3 add_ids_in_filenames.py path_to_your_folder
# Behavior: Scans the folder, takes all files without an ID at the beginning
# consisting of 10 digits, and renames them all to add such an id to them.
# Ids are genrerated serially.
# Before renaming, checks for exact name collision not to overwrite something.
@LudwikJaniuk
LudwikJaniuk / momentum-active-scrapper.js
Created January 23, 2018 17:43
Print all the things in the momentum.earth active view you have opened as plaintext, nice and tidy, parseable.
// Momentum.earth active view scrapper
// Author: Ludvig Janiuk
// To have jQuery as "q" do this first:
var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
// And then:
q = jQuery;
@LudwikJaniuk
LudwikJaniuk / SplitUnityMesh.cs
Last active August 22, 2017 07:55
Recursively converts one big mesh into smaller ones until they all fall under the Unity vertex amount limit. Computes bounds and always splits along the largest axis.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
class SplitUnityMesh
{
private const int MAX_VERTICES = 65500;
mynt = random.randint(0,1)
if ( mynt == 0 ):
krona=krona + 1
else:
klave+=1
# kan ersättas med
mynt = random.randint(0,1)