Skip to content

Instantly share code, notes, and snippets.

@davidsteppenbeck
davidsteppenbeck / KeyframeView.swift
Created May 3, 2024 20:08
Keyframe Animation Example in SwiftUI
import SwiftUI
struct KeyframeValues {
var scale = 1.0
var horizontalStretch = 1.0
var verticalStretch = 1.0
var translation = 0.0
var rotation = Angle.zero
}
@aamiaa
aamiaa / CompleteDiscordQuest.md
Last active May 3, 2024 22:37
Complete Recent Discord Quest

Complete Recent Discord Quest

Note

This no longer works in browser!

Note

This no longer works if you're alone in vc! Somebody else has to join you!

How to use this script:

  1. Accept the quest under User Settings -> Gift Inventory
@meeas
meeas / DebianSid_on_LUKS-BTRFS_with_systemd-boot.md
Last active May 3, 2024 22:30
For installing Debian Sid with LUKS2 encrypted BTRFS filesystem with Systemd-boot and rEFInd bootloaders plus an option for dualboot to Windows

For directly installing Debian Sid not supported by the Debian installer, namely:

  • Single LUKS2 encrypted partition which contains the full installation
  • Single BTRFS filesystem (integrated home partition)
  • Encrypted swapfile in BTRFS subvolume (supports laptop suspend but not hibernate)
  • Uses systemd-boot bootloader (instead of Grub2, also optional rEFInd instructions)
  • Minimal Gnome install (plus instructions for any other DE you wish)
  • Proper user groups for common security tools like sudo-less Wireshark, etc...
  • Optional removal of crypto keys from RAM during laptop suspend
  • Optional configurations for laptops (including fingerprint readers)
@rphlmr
rphlmr / helpers.ts
Last active May 3, 2024 22:28
Drizzle ORM, deep sub queries
/* -------------------------------------------------------------------------- */
/* More here; */
/* -------------------------------------------------------------------------- */
//gist.github.com/rphlmr/0d1722a794ed5a16da0fdf6652902b15
https: export function distinctOn<Column extends AnyColumn>(column: Column) {
return sql<Column["_"]["data"]>`distinct on (${column}) ${column}`;
}
export function jsonBuildObject<T extends SelectedFields>(shape: T) {
import json
import csv
import sys
import datetime
import os
def make_reader(in_json):
# Open location history data
@dreikanter
dreikanter / Interpolator.cs
Last active May 3, 2024 22:25
Spline interpolation in C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
namespace Interpolation
{
/// <summary>
/// Spline interpolation class.
@StagPoint
StagPoint / QuaternionCompression.cs
Last active May 3, 2024 22:23
C# - Use "smallest three" compression for transmitting Quaternion rotations in Unity's UNET networking, from 16 bytes to 7 bytes.
// Copyright (c) 2016 StagPoint Software
namespace StagPoint.Networking
{
using System;
using UnityEngine;
using UnityEngine.Networking;
/// <summary>
/// Provides some commonly-used functions for transferring compressed data over the network using
import torch
import torch.nn as nn
import torch.nn.init as init
import torch.nn.functional as F
# This layer is dropped into your pre-trained PyTorch model where nn.Linear is used
class DoRALayer(nn.Module):
def __init__(self, d_in, d_out, rank=4):
super().__init__()
@OrionReed
OrionReed / dom3d.js
Last active May 3, 2024 22:21
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
@shr00mie
shr00mie / bind9_slave.sh
Last active May 3, 2024 22:17
BIND9 slave for AD DNS master
#!/bin/bash
#
## -------------------------------=[ Info ]=--------------------------------- ##
#
# Inspired by and adapted from:
# /u/rootwyrm
# https://www.reddit.com/r/homelab/comments/3zqg2y/using_bind_linux_as_a_backup_dns_server_to_a/
#
# Successfully tested on:
# - ESXi 6.7 -> Ubuntu Server 18.04