Skip to content

Instantly share code, notes, and snippets.

@Xavier59
Xavier59 / privatekeysolana.js
Created December 28, 2021 14:49
Convert Solana private key from/to base58/uint8array
// exporting from a bs58 private key to an Uint8Array
// == from phantom private key to solana cli id.json key file
// npm install bs58 @solana/web3.js
const web3 = require("@solana/web3.js");
const bs58 = require('bs58');
let secretKey = bs58.decode("[base58 private key here]");
console.log(`[${web3.Keypair.fromSecretKey(secretKey).secretKey}]`);
// exporting back from Uint8Array to bs58 private key
@DropTheSquid
DropTheSquid / instructions.md
Created September 17, 2022 22:31
Instructions to run ME3Tweaks Mod Manager semi successfully on the Steam Deck

The Steam Deck can run Mass Effect Legendary Edition with almost no fiddling (at least if you bought it through Steam; Origin installs will not be covered in this guide specifically but most of it should still work if you can get the vanilla game running), but modding it is a different story. You have to run a windows program that has graphical issues without config changes, and give it access to the game directory because the game runs in a sandbox. I will cover how to get the ME3Tweaks Mod Manager running well enough to install and update mods, and lay out the known issues and limitations.

As a reminder, the modding tool set is built for Windows. Linux is not supported and will not be supported in the forseeable future. Linux specific bugs will very likely not get worked on. This guide is to help the small proportion of users who want to use the mod manager on Linux despite the lack of support and the issues and difficulty it will bring.

Most of this guide will happen in Desktop mode, but by the

@palikhov
palikhov / Faerunian-calendar.js
Last active December 29, 2024 07:08
Calendar of Harptos for donjon calendar generator https://donjon.bin.sh/fantasy/calendar/
{"year_len":365,"events":1,"n_months":17,"months":["Hammer","Midwinter","Alturiak","cHES","Tarsakh","Greengrass","Mirtul","Kythorn","Flamerule","Midsummer","Shieldmeet","Eleasis","Eleint","Harvenstide","Marpenoth","Uktar","Nightal"],"month_len":{"Hammer":30,"Midwinter":1,"Alturiak":30,"cHES":30,"Tarsakh":30,"Greengrass":1,"Mirtul":30,"Kythorn":30,"Flamerule":30,"Midsummer":1,"Shieldmeet":1,"Eleasis":30,"Eleint":30,"Harvenstide":1,"Marpenoth":30,"Uktar":30,"Nightal":30},"week_len":10,"weekdays":["1","2","3","4","5","6","7","8","9","10"],"n_moons":1,"moons":["Selune"],"lunar_cyc":{"Selune":30},"lunar_shf":{"Selune":0},"year":1492,"first_day":0,"notes":{}}
@JorgeMarinoDev
JorgeMarinoDev / wazuh-rule-correlation-example.md
Created November 18, 2023 00:24
Wazuh simple Rule Correlation example

How to write correlation between Rules in Wazuh

November 1st 2023 | by Jorge Marino | Wazuh 4.6

A common question among Wazuh users is how to trigger a rule, after two other rules were triggered.

The current Wazuh Rules' syntax does not include any mechanism to achieve this purpose right out of the box.

@perky
perky / ProFi.lua
Created May 30, 2012 20:32
ProFi, a simple lua profiler that works with LuaJIT and prints a pretty report file in columns.
--[[
ProFi v1.3, by Luke Perkin 2012. MIT Licence http://www.opensource.org/licenses/mit-license.php.
Example:
ProFi = require 'ProFi'
ProFi:start()
some_function()
another_function()
coroutine.resume( some_coroutine )
ProFi:stop()
#version 300 es
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
out vec4 fragColor;
uniform vec2 resolution;
uniform vec3 orientation;
@zqc17
zqc17 / quadratic.lean
Created December 29, 2024 06:56
Solve quadratic equation.
/-- Solve $ax^2 + bx + c = 0, a\neq 0$. -/
theorem Real.quadratic_eq_zero_iff {a b c : ℝ} (ha : a ≠ 0) (h : 0 ≤ discrim a b c) (x : ℝ) :
a * x ^ 2 + b * x + c = 0
x = (-b + sqrt (discrim a b c)) / (2 * a) ∨
x = (-b - sqrt (discrim a b c)) / (2 * a) := by
let d := sqrt <| discrim a b c
have : discrim a b c = d * d := Eq.symm <| mul_self_sqrt h
rw [pow_two, ← mul_assoc, _root_.quadratic_eq_zero_iff ha this x]
@dchest
dchest / uuid.php
Created February 15, 2020 19:26
UUIDv4 generator for PHP 7+
<?php
/**
* Generate a random UUIDv4.
* @return string UUID
*/
function generate_uuid()
{
$b = random_bytes(16);
$b[6] = chr(ord($b[6]) & 0x0f | 0x40);
@av
av / post.md
Created December 28, 2024 20:14
r/LocalLLaMA - a year in review

r/LocalLLaMA - a year in review

This community was a great part of my life for the past two years, so as 2024 comes to a close, I wanted to feed my nostalgia a bit. Let me take you back to the most notable things happened here this year.

This isn't a log of model releases or research, rather things that were discussed and upvoted by the people here. So notable things missing is also an indication of what was going on of sorts. I hope that it'll also show the amount of progress and development that happend in just a single year and make you even more excited for what's to come in 2025.


The year started with the excitement about Phi-2 (443 upvotes, by u/steph_pop). Phi-2 feels like ancient history these days, it's also fascinating that we end the 2024 with the Phi-4. Just one week after, people discovered that apparently it [was trained on the software engineer's diary](https://reddit.com/r/LocalLLaMA/comments/1

import asyncio
import base64
import json
import os
import pyaudio
from websockets.asyncio.client import connect
class SimpleGeminiVoice:
def __init__(self):