Skip to content

Instantly share code, notes, and snippets.

View shekohex's full-sized avatar

shekohex

View GitHub Profile
@shekohex
shekohex / evmToSubstrate.ts
Created July 26, 2023 12:50
Convert EVM Address to Substrate address
import {
blake2AsU8a,
encodeAddress,
} from "https://esm.sh/@polkadot/util-crypto";
import {
hexToU8a,
stringToU8a,
u8aConcat,
} from "https://esm.sh/@polkadot/util";
@shekohex
shekohex / init.lua
Created July 10, 2023 13:09
Minimum Neovim Config file to work on Servers
-- Contains Neovim/Vim API and Settings.
vim.g.mapleader = " "
vim.g.maplocalleader = " "
local opt = vim.opt
opt.hlsearch = false
opt.autowrite = true -- Enable auto write
opt.clipboard = "unnamedplus" -- Sync with system clipboard
@shekohex
shekohex / generate-kpi.ts
Last active April 10, 2023 16:27
Generates KPIs for github repo
#!/usr/bin/env -S deno run -A
/**
* This script is used to generate the KPIs for a repository, by fetching all
* the issues/bugs that got resolved and the PRs that got merged in the specified time period.
* It then outputs the KPIs in a Markdown format.
*/
// Import the required modules, we need the following:
// * cli - for parsing the command line arguments
// * github - for fetching the issues/PRs from GitHub
@shekohex
shekohex / main.dart
Created January 23, 2023 20:57
An Example of using Mobile Scanner package
import 'package:flutter/material.dart';
import 'package:mobile_scanner/mobile_scanner.dart'; // version ^3.0.0-beta.4
void main() => runApp(const MaterialApp(home: MyHome()));
class MyHome extends StatelessWidget {
const MyHome({super.key});
@override
Widget build(BuildContext context) {
@shekohex
shekohex / wezterm.applescript
Created June 13, 2022 12:49
Wezterm with Alfred Custom Terminal
on alfred_script(q)
tell application "wezterm" to activate
do shell script "/Applications/WezTerm.app/Contents/MacOS/wezterm cli send-text "
tell application "System Events" to keystroke q
tell application "System Events"
key code 36 -- enter key
end tell
end alfred_script
@shekohex
shekohex / [email protected]@4.4.2...utils...Strings.sol
Created January 19, 2022 15:41
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
@shekohex
shekohex / Cargo.toml
Created July 14, 2021 22:50
The Code for Building Secure E2EE Chat Apps in Rust and Flutter (Part 1)
[package]
name = "chitchat"
version = "0.1.0"
edition = "2018"
[dependencies]
x25519-dalek = "^1.1"
rand = { version = "0.7", default-features = false, features = ["getrandom"] }
chacha20poly1305 = { version = "0.7", default-features = false, features = ["std", "chacha20"] }
/// For https://github.com/mitsuhiko/redis-rs/issues/509
///
/// redis crate v0.20
/// tokio crate v1
/// tokio-stream crate v0.1
use std::sync::Arc;
use future::Either;
use futures::future;
@shekohex
shekohex / evmToEdg.ts
Created April 1, 2021 17:38
Convert EVM address to EDG address
import {
blake2AsU8a,
encodeAddress,
} from "https://esm.sh/@polkadot/util-crypto";
import {
hexToU8a,
stringToU8a,
u8aConcat,
} from "https://esm.sh/@polkadot/util";
@shekohex
shekohex / main.dart
Created March 11, 2021 17:57
Color To Hex
import 'dart:ui';
extension ColorHex on Color {
String toHex({bool withPrefix = false}) {
final hex = value.toRadixString(16);
return withPrefix ? '0x$hex' : hex;
}
}
void main() {