Skip to content

Instantly share code, notes, and snippets.

@bryanjhv
bryanjhv / Crypt.ts
Created January 18, 2024 21:01
Laravel Encryption Crypt WebCrypto implementation
function s2b(data: string) {
return Uint8Array.from(data, c => c.charCodeAt(0)).buffer
}
function b2s(data: ArrayBufferLike) {
return String.fromCharCode(...new Uint8Array(data))
}
function hex(data: ArrayBufferLike) {
return [...new Uint8Array(data)].map(x => x.toString(16).padStart(2, '0')).join('')
#!/bin/bash
set -x
DBUS="gdbus call -y"
DEST=org.freedesktop.UDisks2
OBJP=/org/freedesktop/UDisks2/block_devices/sdb
$DBUS -d $DEST -o $OBJP -m $DEST.Block.Format dos {}
$DBUS -d $DEST -o $OBJP -m $DEST.PartitionTable.CreatePartition 4194304 0 0x0e "" {}
package main
import (
"fmt"
"maps"
"slices"
"sort"
"github.com/godbus/dbus/v5"
)
package main
import (
"cmp"
"context"
"fmt"
"slices"
"time"
_ "github.com/joho/godotenv/autoload"
DELETE FROM mysql.global_priv WHERE User='';
DELETE FROM mysql.global_priv WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');
DROP DATABASE IF EXISTS test;
DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%';
FLUSH PRIVILEGES;