Skip to content

Instantly share code, notes, and snippets.

View beautyfree's full-sized avatar
😼

Alexey Elizarov beautyfree

😼
View GitHub Profile
@khalidx
khalidx / node-typescript-esm.md
Last active May 8, 2024 07:58
A Node + TypeScript + ts-node + ESM experience that works.

The experience of using Node.JS with TypeScript, ts-node, and ESM is horrible.

There are countless guides of how to integrate them, but none of them seem to work.

Here's what worked for me.

Just add the following files and run npm run dev. You'll be good to go!

package.json

@m-esm
m-esm / code-node.js
Last active July 16, 2023 01:34
embassy-appointment-n8n
const vision = require("@google-cloud/vision");
const puppeteer = require("puppeteer");
const fs = require("fs-extra");
const URL = "https://YOUR_EMBASSY_URL_AND_THE_PAGE";
const browser = await puppeteer.connect({
browserWSEndpoint: `ws://browserless:3000?token=TOKEN_HERE`,
args: [`--window-size=1024,860`],
defaultViewport: {
// Created by Anderson Mancini 2023
// React Three Fiber AutoFocus Component to be used
// as an extension for default Depth Of Field from react-three/postprocessing
// HOW TO USE?
// import AutoFocusDOF from './AutoFocusDOF'
//
// And add this component inside the EffectsComposer...
//...
// <EffectComposer>
import { planetHexasphere } from '../client/hexasphere.js';
import PlanetGenerator from '../client/planet-generator.js';
import '../hybrid/helpers.js';
import { prettyUrl } from '../../../deps.js';
import { getHexagonalGeometry } from '../hybrid/coordinates.js';
class Generator {
constructor() {
return new Promise(async resolve => {
@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
@aheckmann
aheckmann / burn.md
Last active January 5, 2023 22:53
How to get rid of Solana spam NFTs
  1. Open a private tab
  2. Create a completely new wallet by visiting https://www.sollet.io
  3. You will see a screen displaying "Create new wallet" and a list of seed words
  4. Copy the seed words
  5. Check the box next to "I have saved these words in a safe place."
  6. Click "DOWNLOAD BACKUP MNEMONIC FILE (REQUIRED)". This downloads your seed phrase. Delete this file.
  7. Click "continue"
  8. Paste the seed words when it asks you to, then click continue
  9. Click "Main Account" at the top of the screen to copy the new wallet address. This address is where you'll send your spam NFTs.
  10. Open your Phantom wallet (assuming you are using Phantom)
@FrankC01
FrankC01 / main.rs
Created October 20, 2021 10:38
Emulating Vector of Structures into Solana Account `data`
// Used to map pointers into data array
use arrayref::{array_mut_ref, array_ref, array_refs, mut_array_refs};
use borsh::{BorshDeserialize, BorshSerialize};
use std::iter::repeat;
const INITIALIZED_BYTES: usize = 1;
const VECTOR_CHUNK_LENGTH: usize = 4;
const VECTOR_CHUNK_BYTES: usize = 5116;
const DATA_ACCOUNT_STATE_SPACE: usize =
INITIALIZED_BYTES + VECTOR_CHUNK_LENGTH + VECTOR_CHUNK_BYTES;
@FrankC01
FrankC01 / main.rs
Last active January 24, 2024 18:39
Faux example of serializing BTreeMap to Solana State
use std::{collections::BTreeMap, iter::repeat};
use arrayref::{array_mut_ref, array_ref, array_refs, mut_array_refs};
use borsh::{BorshDeserialize, BorshSerialize};
const INITIALIZED_BYTES: usize = 1;
const TRACKING_CHUNK_LENGTH: usize = 4;
const TRACKING_CHUNK_BYTES: usize = 5116;
const TRACKING_ACCOUNT_STATE_SPACE: usize =
INITIALIZED_BYTES + TRACKING_CHUNK_LENGTH + TRACKING_CHUNK_BYTES;
@gjreasoner
gjreasoner / README.md
Last active April 25, 2024 01:42
Expand Ubuntu 20 Proxmox Disk
# Resize the file system in UI, under VM -> Hardware -> Click on the disk to resize, click "Resize disk" button

# Confirm increase in disk space (1TB in my case)
$ lsblk
NAME                      MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda                         8:0    0    1T  0 disk
├─sda1                      8:1    0    1M  0 part
├─sda2                      8:2    0    1G  0 part /boot
└─sda3                      8:3    0    1T  0 part
@triangletodd
triangletodd / README.md
Last active May 7, 2024 19:35
k3s in LXC on Proxmox

On the host

Ensure these modules are loaded

cat /proc/sys/net/bridge/bridge-nf-call-iptables

Disable swap

sysctl vm.swappiness=0
swapoff -a