Skip to content

Instantly share code, notes, and snippets.

@joerodgers
joerodgers / Get-SiteCollectionPermission.ps1
Last active May 7, 2024 21:53
Example script that users the PnP.PowerShell module to export the permissions of all uniquely permissioned webs and associated M365 Groups Owners and M365 Group Members
#requires -Modules @{ ModuleName="PnP.Powershell"; ModuleVersion="1.11.0" }
[System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12
function Get-SiteCollectionPermission
{
<#
.SYNOPSIS
Returns all the webs in the site collection with unique permissions. If the site is group connected, also exports the group owners and group members.
@PurpleVibe32
PurpleVibe32 / vmwk17key.txt
Last active May 7, 2024 21:52
Free VMware Workstation Pro 17 full license keys
Install VMWare Workstation PRO 17 (Read it right. PRO!)
Also, these keys might also work with VMWare Fusion 13 PRO. Just tested it.
Sub to me on youtube pls - PurpleVibe32
if you want more keys - call my bot on telegram. @purector_bot (THE BOT WONT REPLY ANYMORE) - Or: https://cdn.discordapp.com/attachments/1040615179894935645/1074016373228978277/keys.zip - the password in the zip is 102me.
---
This gist can get off at any time.
PLEASE, DONT COPY THIS. IF YOU FORK IT, DONT EDIT IT.
*If you have a problem comment and people will try to help you!
*No virus
@ad3m3r5
ad3m3r5 / proxmox-unprivileged-lxc-coral-usb.md
Last active May 7, 2024 21:50
USB Coral TPU Passthrough for Unprivileged LXC in Proxmox

This guide is how I got a Coral TPU (USB) working in an unprivileged LXC container.

At the end, you should be able to use the Coral TPU for inferencing inside of an unprivileged LXC container as well as Docker containers within the LXC, such as Frigate.

This does NOT require privileged LXC or docker container.

NOTES:

  • Proxmox Version: 8.1.10
  • LXC Container: Debian 10/11 (Example #1)
    • Debian 12 was used as the Docker host (Example #2)
@jrknox1977
jrknox1977 / ollama_dspy.py
Created February 9, 2024 18:06
ollama+DSPy using OpenAI APIs.
# install DSPy: pip install dspy
import dspy
# Ollam is now compatible with OpenAI APIs
#
# To get this to work you must include `model_type='chat'` in the `dspy.OpenAI` call.
# If you do not include this you will get an error.
#
# I have also found that `stop='\n\n'` is required to get the model to stop generating text after the ansewr is complete.
# At least with mistral.
@kenji4569
kenji4569 / ulid_converter.sql
Last active May 7, 2024 21:46
ULID (26 characters in Crockford's base32) conversion for MySQL function
# Define ULID_DECODE and ULID_ENCODE which convert a ulid string to a binary and vice versa.
delimiter //
DROP FUNCTION IF EXISTS ULID_DECODE//
CREATE FUNCTION ULID_DECODE (s CHAR(26)) RETURNS BINARY(16) DETERMINISTIC
BEGIN
DECLARE s_base32 CHAR(26);
SET s_base32 = REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(UPPER(s), 'J', 'I'), 'K', 'J'), 'M', 'K'), 'N', 'L'), 'P', 'M'), 'Q', 'N'), 'R', 'O'), 'S', 'P'), 'T', 'Q'), 'V', 'R'), 'W', 'S'), 'X', 'T'), 'Y', 'U'), 'Z', 'V');
RETURN UNHEX(CONCAT(LPAD(CONV(SUBSTRING(s_base32, 1, 2), 32, 16), 2, '0'), LPAD(CONV(SUBSTRING(s_base32, 3, 12), 32, 16), 15, '0'), LPAD(CONV(SUBSTRING(s_base32, 15, 12), 32, 16), 15, '0')));
END//
@jjb
jjb / file.md
Last active May 7, 2024 21:46
Using Jemalloc 5 with Ruby.md

For years, people have been using jemalloc with ruby. There were various benchmarks and discussions. Legend had it that Jemalloc 5 didn't work as well as Jemalloc 3.

Then, one day, hope appeared on the horizon. @wjordan offered a config for Jemalloc 5.

Ubuntu/Debian

FROM ruby:3.1.2-bullseye
RUN apt-get update ; \
@cyrbil
cyrbil / iptables_blocklist.sh
Last active May 7, 2024 21:43
A small script to create iptables rules to block known malware IPs
#!/bin/bash
set -o errexit
set -o errtrace
set -o functrace
set -o pipefail
set -o nounset
[ -z ${DEBUG+x} ] || set -o xtrace
@wojteklu
wojteklu / clean_code.md
Last active May 7, 2024 21:42
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

import { useCallback, useEffect, useRef } from 'react';
import { debounce } from 'lodash';
import { FormikValues } from 'formik';
import { FormikConfig } from 'formik/dist/types';
export function useDebouncedValidate<T extends FormikValues>({
values,
validate,
debounceTime = 200,
}: {
@amitxv
amitxv / XHCI-IMOD-Interval.ps1
Last active May 7, 2024 21:32
Configure the IMOD Interval for XHCI controllers with RWEverything
param(
[switch]$verbose
)
# The variables starting with $GLOBAL store values that should be applied to all XHCI controllers by default.
# To override this default value on a per-controller basis, specify the DEV_XXXX hardware ID value for the XHCI controller along with its data
# See the example below.
#
# $globalInterval = 0x0
# $globalHCSPARAMSOffset = 0x4