Skip to content

Instantly share code, notes, and snippets.

View v-stickykeys's full-sized avatar
💫

stickykeys v-stickykeys

💫
View GitHub Profile
@v-stickykeys
v-stickykeys / LevelDbViewer-README.md
Last active September 26, 2022 19:50
LevelDb Viewer

Install dependencies

npm install levelup leveldown encoding-down @pcan/leveldb-viewer

(Or using the package.json here just npm install)

Node the web UI server

const AWS = require('aws-sdk')
const s3 = new AWS.S3()
// Migration in bucket
// SOURCE_BUCKET=... node s3-shard-migration.js
// Migration from one source bucket to a target bucket
// SOURCE_BUCKET=... TARGET_BUCKET=... node s3-shard-migration.js
// TODO consider retry/backoff/connect config again
@v-stickykeys
v-stickykeys / rust_bytes_to_string.rs
Created September 18, 2021 00:05
Rust Rocket Bytes to String
let string = "wgmi".to_string();
println!("{:?}", string);
let bytes: Bytes = string.into();
println!("{}", String::from_utf8(Vec::from(bytes.as_ref())).unwrap());
@v-stickykeys
v-stickykeys / discordWebhookNotifier.js
Last active May 4, 2021 19:12
discordWebhookNotifier.js
const https = require('https')
async function main() {
const embeds = [
{
title: 'Test Title',
description: 'This is a test description.',
color: 16776960,
fields: [
{
@v-stickykeys
v-stickykeys / getSolcVersion.ts
Last active April 4, 2023 11:16
Solidity pragma version regex
export async function getSolcVersion(filePath: string): Promise<string> {
const rl = readline.createInterface({
input: fs.createReadStream(filePath),
crlfDelay: Infinity
});
let versionFound = false;
for await (const line of rl) {
if (line.startsWith('pragma')) {
versionFound = true;
@v-stickykeys
v-stickykeys / index.js
Last active January 3, 2021 20:00
Node.js script to get an image hash
const { imageHash } = require('image-hash')
const image_url = 'https://media-exp1.licdn.com/dms/image/C4E03AQHTR_sKct2nmQ/profile-displayphoto-shrink_400_400/0/1594060729957?e=1613606400&v=beta&t=qVd6Yatw3WjkiVeo9ouKnC8h2lLbefQm6HROcxYE4Yc'
const bits = 16 // the more bits, the more unique the hash
const precise = true
async function main() {
const prom = new Promise((resolve, reject) => {
imageHash(image_url, bits, precise, (error, data) => {
if (error) reject(error)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ANSIBlackColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS
AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NPECow
LjA5ODAzOTIxNTY5IDAuMDk4MDM5MjE1NjkgMC4wOTgwMzkyMTU2OQAQAoAC0hAREhNa
JGNsYXNzbmFtZVgkY2xhc3Nlc1dOU0NvbG9yohIUWE5TT2JqZWN0XxAPTlNLZXllZEFy
// This is not clean and some of it needs to be deleted but hey, it works!
import React from "react";
import Box from "3box";
import Web3 from "web3";
function Test3Box() {
const [connectedToMM, setConnectedToMM] = React.useState(false);
const [account, setAccount] = React.useState("");
const [web3, setWeb3] = React.useState(null);
{
"trailingComma": "es5",
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": false,
"bracketSpacing": true,
"arrowParens": "always",
"endOfLine": "lf"
}
@v-stickykeys
v-stickykeys / simple-python-websocket
Created March 23, 2020 18:32
simple-python-websocket
#!/usr/bin/env python
# WS server example
# https://websockets.readthedocs.io/en/stable/intro.html
"""
`pip install websockets` then run as a script
"""
import asyncio