Skip to content

Instantly share code, notes, and snippets.

@TreeHappy
TreeHappy / Check.ps1
Last active January 29, 2025 16:13
Powershell admin
# Check if the script is running with administrative privileges
function Test-Admin {
$isAdmin = [Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()
return $isAdmin.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
}
# Function to elevate the shell
function Elevate-Shell {
Start-Process powershell -ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs
}
We can't make this file beautiful and searchable because it's too large.
month,day,versions
2,4,"[5.12, 5.12]"
2,4,"[5.12, 5.12]"
2,4,"[5.12, 5.12]"
2,4,"[5.12, 5.12]"
2,4,"[5.12, 5.12]"
2,4,"[5.12, 5.12]"
2,4,"[5.10, 5.10]"
2,4,"[5.10, 5.10]"
2,4,"[5.12, 5.12]"
#!/bin/bash
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install linux --extra-conf "sandbox = false" --init none --no-confirm
PATH="${PATH}:/nix/var/nix/profiles/default/bin"
#
# https://github.com/NixOS/nix/issues/3435#issuecomment-1642654775
# This is... but other solutins can't avoid following error
# error: could not set permissions on '/nix/var/nix/profiles/per-user' to 755: Operation not permitted
sudo chown --recursive $(whoami) /nix
return {
"catppuccin/nvim",
name = "catppuccin",
config = function()
require("catppuccin").setup {
flavour = "mocha", -- latte, frappe, macchiato, mocha
term_colors = true,
transparent_background = true,
no_italic = false,
no_bold = false,
// See https://aka.ms/new-console-template for more information
Cadfkljonsole.WriteLine("Hello, Worldddd!");
@TreeHappy
TreeHappy / covariance_matrix.cpp
Created April 7, 2023 12:04 — forked from att88/covariance_matrix.cpp
Compute the Covariance Matrix of a 3D Point Cloud
void PointCloud::computeCovarianceMatrix() {
double means[3] = {0, 0, 0};
for (int i = 0; i < points.size(); i++)
means[0] += points[i].x,
means[1] += points[i].y,
means[2] += points[i].z;
means[0] /= points.size(), means[1] /= points.size(), means[2] /= points.size();
for (int i = 0; i < 3; i++)
for (int j = 0; j < 3; j++) {
using System;
using System.Collections.Generic;
using System.Linq;
namespace RecommenderSystem
{
public class Recommender
{
private Dictionary<string, Dictionary<string, double>> data;
@TreeHappy
TreeHappy / Code.cs
Last active October 17, 2022 09:39
WeakReferenceTest
using System;
using System.Collections.Generic;
using System.Linq;
namespace Code;
public class DependencySourceChangedArgs : EventArgs
{
public WeakReference<IDependencySource> Source { get; }
public object Change { get; }