Skip to content

Instantly share code, notes, and snippets.

@Phlow
Phlow / for-loop-sorted-collection
Last active April 30, 2024 13:30
This Liquid loop for Jekyll sorts a collection by date in reverse order
{% comment %}
*
* This loop loops through a collection called `collection_name`
* and sorts it by the front matter variable `date` and than filters
* the collection with `reverse` in reverse order
*
* To make it work you first have to assign the data to a new string
* called `sorted`.
*
{% endcomment %}
function Find-VisualStudio() {
Write-Information "Finding VisualStudio .exe path"
$vsWherePath = join-path ${env:ProgramFiles(x86)} "\Microsoft Visual Studio\Installer\vswhere.exe"
Write-Debug "Checking for vswhere.exe at $vsWherePath"
if (-not (Test-Path $vsWherePath)) {
Write-Error "vswhere.exe not found at $vsWherePath"
exit 1
}
Write-Debug "Finding VisualStudio Installation Location using:"
@tsensei
tsensei / semantic-chunker.ts
Created April 5, 2024 14:33
This TypeScript snippet processes a large corpus of text to output semantic chunks by tokenizing into sentences, combining them for context, generating sentence embeddings with OpenAI's service, calculating cosine similarities to identify semantic shifts, and finally grouping sentences into semantically cohesive chunks based on these shifts.
import "dotenv/config";
import { OpenAIEmbeddings } from "@langchain/openai";
import { TextLoader } from "langchain/document_loaders/fs/text";
import natural from "natural";
import * as math from "mathjs";
import { quantile } from "d3-array";
interface SentenceObject {
sentence: string;
index: number;
@NISH1001
NISH1001 / sql-server-cdc.md
Last active April 30, 2024 13:24
CDC (change data capture) for Microsoft SQL server

MSSQL CLI

github...

UI

https://dbeaver.io/

sqlcmd -S <ip> -d <dbname> -U <username> -P <password> -I
@brandonsturgeon
brandonsturgeon / bis.md
Last active April 30, 2024 13:23
World of Warcraft 3.3.5a Warmane Complete PvE BiS (Best In Slot) List
@Gustavo-Kuze
Gustavo-Kuze / force-ctrl-c-v.md
Last active April 30, 2024 13:22
Enable copy and paste in a webpage from the browser console
javascript:(function(){
  allowCopyAndPaste = function(e){
  e.stopImmediatePropagation();
  return true;
  };
  document.addEventListener('copy', allowCopyAndPaste, true);
  document.addEventListener('paste', allowCopyAndPaste, true);
  document.addEventListener('onpaste', allowCopyAndPaste, true);
})(); 

Docker on Lima (lima-vm/lima) Setup Guide

In recent months, Lima has become de facto standard software as a free and open source alternative to Docker Desktop for Mac. Several projects (such as Colima, Rancher Desktop, or Finch) for similar purpose also uses Lima as their backend. These projects will make it easier to set up Lima. But some people may not want to introduce extra components other than Lima. This guide will show you how to set up Lima to be alternative to Docker Desktop for Mac, while using Lima only.

🪣 Note. It is a good practice to uninstall Docker Desktop for Mac before proceeding with the following steps.

1. Install Lima and Docker CLI

@Lucas-Kohorst
Lucas-Kohorst / univ3Fees.py
Created August 1, 2021 20:28
Get fees, upper and lower price bounds for a uv3 position
## Thanks to https://twitter.com/JNP7771 for the script at https://playcode.io/780618/
## imports
import requests
import json
import pandas as pd
import math
from beautifultable import BeautifulTable
x96 = math.pow(2, 96)
@unixfox
unixfox / readme.md
Last active April 30, 2024 13:20
How to get IPv4 connectivity on an IPv6 only VPS

Some hosting providers like scaleway allows to remove the IPv4 from the VPS in order to save 1€/month but doing this will result in losing connectivity to the "IPv4 world".
Or you may have ordered a VPS that only has IPv6 connectivity and you want to access to a resource only accessible from the "IPv4 world".
Here is how to gain your access back to the "IPv4 world".

Change your name servers(s) to DNS64 name servers(s)

Note: You may deploy your own DNS64 & NAT64 server on a separate server by following this tutorial (untested): https://packetpushers.net/nat64-setup-using-tayga/.
Note²: You may find a explanation of what is NAT64 and DNS64 on Wikipedia.

  1. Choose a/multiple DNS64 public server(s) that has/have its own NAT64 public service from this list:
@KeithYeh
KeithYeh / Self-Signed SSL with SAN.md
Created October 14, 2017 13:12
Create self-signed SSL certificate with SubjectAltName(SAN)

How to create a self-signed SSL Certificate with SubjectAltName(SAN)

After Chrome 58, self-signed certificate without SAN is not valid anymore.

Step 1: Generate a Private Key

openssl genrsa -des3 -out example.com.key 2048

Step 2: Generate a CSR (Certificate Signing Request)