Skip to content

Instantly share code, notes, and snippets.

@UnknownWitcher
UnknownWitcher / potato_patcher.pyw
Last active May 7, 2024 18:37 — forked from BluBb-mADe/potato_patcher.py
Generic Voicemeeter Potato in-memory patch
import os
import sys
import subprocess
import traceback
try:
from pymem import Pymem, process, exception
from win11toast import notify
import psutil
@radovankavicky
radovankavicky / LandGrid.js
Created December 13, 2016 08:41 — forked from rbrath/LandGrid.js
Equal Size Cartogram
var landGrid = [
{
"X": "1",
"Y": "1"
},
{
"X": "1",
"Y": "2"
},
{
@laobubu
laobubu / ABOUT.md
Last active May 7, 2024 18:37
A very simple HTTP server in C, for Unix, using fork()

Pico HTTP Server in C

This is a very simple HTTP server for Unix, using fork(). It's very easy to use

How to use

  1. include header httpd.h
  2. write your route method, handling requests.
  3. call serve_forever("12913") to start serving on port 12913
@BluBb-mADe
BluBb-mADe / potato_patcher.py
Last active May 7, 2024 18:36
Generic Voicemeeter Potato in-memory patch
import os
import sys
import time
import subprocess
import traceback
from pymem import Pymem, process, exception
#############################################################################################
# This is an in-memory patch that launches and patches Voicemeeter Potato in memory on startup.
@pavlov99
pavlov99 / haversine.scala
Created December 19, 2016 07:52
Spherical distance calcualtion based on latitude and longitude with Apache Spark
// Based on following links:
// http://andrew.hedges.name/experiments/haversine/
// http://www.movable-type.co.uk/scripts/latlong.html
df
.withColumn("a", pow(sin(toRadians($"destination_latitude" - $"origin_latitude") / 2), 2) + cos(toRadians($"origin_latitude")) * cos(toRadians($"destination_latitude")) * pow(sin(toRadians($"destination_longitude" - $"origin_longitude") / 2), 2))
.withColumn("distance", atan2(sqrt($"a"), sqrt(-$"a" + 1)) * 2 * 6371)
>>>
+--------------+-------------------+-------------+----------------+---------------+----------------+--------------------+---------------------+--------------------+------------------+
|origin_airport|destination_airport| origin_city|destination_city|origin_latitude|origin_longitude|destination_latitude|destination_longitude| a| distance|
#!/usr/bin/env bash
# Abort sign off on any error
set -e
# Start the benchmark timer
SECONDS=0
# Repository introspection
OWNER=$(gh repo view --json owner --jq .owner.login)
@nunomazer
nunomazer / main.dart
Created March 25, 2020 22:05
Funções em Dart
// Função sem parâmetros
void escreverBemVindo(){
print("Seja bem-vindo!");
}
// Quando a função só tem um comando interno
// Substitui abertura e fechamento de bloco, e o comando return
void escreverTipoFuncao() => print("Função com um comando.");
// Função com passagem de parâmetros (podem ter quantos parâmetros quiser)
@rechner
rechner / freeipa-openvpn.md
Last active May 7, 2024 18:27
FreeIPA setup for OpenVPN logins

This article proved to be a decent starting point, but I was particularly interested in allowing password-based logins to OpenVPN using a username/password backed by FreeIPA (opposed to client certificates) as the identity provider.

  • IPA join your VPN machine: ipa-client-install --mkhomedir
  • Get a kerberos ticket: kinit
  • Create a Kerberos service principle and HBAC rule for openvpn access:
ipa service-add openvpn/`hostname`
  • Create new hbacrule in console, mark host as the VPN host, and whatever group you want to restrict access to:
@aamiaa
aamiaa / CompleteDiscordQuest.md
Last active May 7, 2024 18:27
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
@davepcallan
davepcallan / AddColumnIfNotExists.sql
Created May 7, 2024 16:20
Add created_date column to all tables which don't have it already in SQL Server
SELECT 'ALTER TABLE ' + QUOTENAME(ss.name) + '.' + QUOTENAME(st.name) + ' ADD created_date DATETIME NULL;'
FROM sys.tables st
INNER JOIN sys.schemas ss on st.[schema_id] = ss.[schema_id]
WHERE st.is_ms_shipped = 0
AND NOT EXISTS (
SELECT 1
FROM sys.columns sc
WHERE sc.[object_id] = st.[object_id]
AND sc.name = 'created_date'
)