Skip to content

Instantly share code, notes, and snippets.

View OptoCloud's full-sized avatar
🇳🇴
OptoCloud#0001

Eirik Bøe OptoCloud

🇳🇴
OptoCloud#0001
View GitHub Profile
# Set limits
sudo ipmitool sensor thresh FANA lower 400 500 600
sudo ipmitool sensor thresh FANA upper 2500 2600 2700
sudo ipmitool sensor thresh FAN1 lower 1000 1100 1200
sudo ipmitool sensor thresh FAN1 upper 5000 5100 5200
sudo ipmitool sensor thresh FAN3 lower 700 800 900
sudo ipmitool sensor thresh FAN3 upper 1500 1600 1700
@OptoCloud
OptoCloud / +page.server.ts
Created May 4, 2023 17:39
SvelteKit CF Turnstile
import { Turnstile } from '$lib/server/cloudflare/index.js';
import { TurnstileUserErrorMessage } from '$lib/server/cloudflare/turnstile.js';
import { fail } from '@sveltejs/kit';
/** @type {import('./$types').Actions} */
export const actions = {
default: async ({ request }) => {
const body = await request.formData();
// Validate turnstile
@OptoCloud
OptoCloud / Program.cs
Last active September 7, 2023 07:02
Quick String Replacer (Thanks @just-ero for the help!)
using OptoCloud;
var summary = BenchmarkDotNet.Running.BenchmarkRunner.Run<StringReplaceBenchmark>();
import bpy
import mathutils
def GetMesh(obj_name):
obj = bpy.data.objects.get(obj_name)
if obj is None:
return None
return obj.data
def GetShapeKey(mesh, shape_key_name):
import os
import gzip
import shutil
import tarfile
def ensure_dir(dir):
if not os.path.exists(dir):
os.makedirs(dir)
def move_if_exists(src, dst):
@OptoCloud
OptoCloud / blender_remove_garbage.py
Created May 1, 2022 07:45
Blender remove empty Vertex Groups and Shape Keys
## Remove empty vertex groups and shape keys
## Credits:
## https://blender.stackexchange.com/questions/237599/is-there-a-way-to-automatically-delete-shape-keys-that-are-identical-to-the-basi
## https://blender.stackexchange.com/questions/16517/how-to-quickly-remove-all-zero-weight-vertex-groups
import bpy
import numpy as np
# Tolerance to small differences, change it if you want
tolerance = 0.001
@OptoCloud
OptoCloud / etc-network-interfaces
Last active April 20, 2023 18:17
Configure firewall for my server ( thanks @hbjydev and @RequiDev)
... yada yada ...
auto vmbr0
iface vmbr0 inet static
address 10.0.0.1/24
bridge-ports none
bridge-stp off
bridge-fd 0
post-up bash /root/post-up.sh
@OptoCloud
OptoCloud / ReferenceLocator.cs
Last active November 16, 2023 11:39
Finds duplicate and linked assets
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEditor.Animations;
using UnityEngine;
public class LinkedMaterialSelector : EditorWindow
{
static bool FileExistsScuffed(string path)
{