Skip to content

Instantly share code, notes, and snippets.

View Tiim's full-sized avatar

Tiim

View GitHub Profile
import { browser } from '$app/environment';
import { urls } from '@/config';
import { createClient, queryStore } from '@urql/svelte';
import { derived, readable } from 'svelte/store';
/**
* Helper function to create an urql client in a server side only load function
*
*
* @param {import('@sveltejs/kit').Cookies} cookies
@Tiim
Tiim / fitbit.js
Created April 21, 2022 15:53
Obsidian Fitbit Activity User Script
const path = require("path");
const fs = require("fs").promises;
/*
# Fitbit Activity in Obsidian
## What does it do?
Insert a list of your fitbit activities into an obsidian note.
@Tiim
Tiim / Vagrantfile
Last active November 3, 2021 11:35
Vagrantfile for logcabin
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.provider "virtualbox" do |v|
v.memory = 3072
v.cpus = 4
end
config.vm.provision "shell", inline: <<-SHELL
import bpy
import os
import re
from bpy_extras import io_utils
from zipfile import ZipFile
EXPORT_SINGLE = False # Only export the selected Collection and not seperate files
ENABLE_ZIP = True
@Tiim
Tiim / bake_displacement.py
Last active August 4, 2021 11:36
Blender Script to bake Displacement map from high poly model to low poly model
import bpy
# uses method described here:
# https://blender.stackexchange.com/questions/228646/how-to-bake-displacement-map-from-another-mesh-not-multires/228659#228659
IMAGE_RES = 1024
def err(msg):
#!/usr/bin/env bash
# This script should be called inside a docker container
# to backup the database.
# $ ./backup.sh [hourly|daily|weekly|monthly|yearly]
# The environment variables for pg_dumpall need to be set.
set -e
# First command line arg.
<!DOCTYPE html>
<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<title>Stopwatch</title>
<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@600&display=swap" rel="stylesheet">
</head>
@Tiim
Tiim / query.js
Created March 7, 2020 11:04
Query Inside JS object like lodash _.get but handles arrays as well
function queryObject(object, path) {
const parts = path.split('.');
let objects = wrapArray(object);
while (parts.length > 0 && objects.length > 0) {
const prop = parts.shift();
objects = objects
.flatMap((o) => wrapArray(o[prop]))
.filter((o) => o != null);
}
return objects;
@Tiim
Tiim / Makefile
Created April 4, 2019 06:51
Makefile that compiles every source file to a executable in the bin dir. Conserves data structure.
CC = gcc
OBJDIR = bin
exec = udp/server udp/client tcp/server tcp/client
.PHONY: all clean
all: $(OBJDIR) $(exec)
clean:
rm -r $(OBJDIR)
@Tiim
Tiim / alex2.py
Last active February 13, 2018 20:00
import csv
import datetime
import math
##TODO: Ändere die zeiten an denen du die mittelwerte berechnene willst
# Liste von allen zeiden von denen du das mittel willst
mittelZeiten = [{'hour': 13, 'min': 10},
{'hour': 16, 'min': 30}]