Skip to content

Instantly share code, notes, and snippets.

View shekohex's full-sized avatar

shekohex

View GitHub Profile
@shekohex
shekohex / hashx_module.ll
Last active August 20, 2024 14:20
A Simple HashX program in LLVM IR
; ModuleID = 'hashx_module'
source_filename = "hashx_module"
target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite)
define void @compute(ptr %0) local_unnamed_addr #0 {
entry:
%const3463 = bitcast i64 -489410267 to i64
%const3447 = bitcast i64 -1543264299 to i64
%const3440 = bitcast i64 -2121149370 to i64
@shekohex
shekohex / substrateToEvm.ts
Created January 2, 2024 12:09
Convert Substrate Address to EVM
import { decodeAddress } from "https://esm.sh/@polkadot/util-crypto";
import { u8aToHex } from "https://esm.sh/@polkadot/util";
const input = Deno.args[0];
if (!input) {
console.error("usage: deno run substrateToEvm.ts <SUBSTRATE_ADDRESS_HERE>");
Deno.exit(1);
}
const accountId = decodeAddress(input);
const res = accountId.subarray(0, 20);
@shekohex
shekohex / claimsNative.rs
Last active January 5, 2024 12:11
Testing Pallet claims Native
import "npm:@webb-tools/tangle-substrate-types@^0.5.1";
import { ApiPromise, WsProvider } from "npm:@polkadot/[email protected]";
import { Keyring } from "npm:@polkadot/[email protected]";
import {
hexToU8a,
stringToU8a,
u8aToHex,
u8aToString,
} from "npm:@polkadot/[email protected]";
import { decodeAddress, keccakAsU8a } from "npm:@polkadot/[email protected]";
@shekohex
shekohex / claimsEVM.ts
Last active January 3, 2024 12:06
Testing Pallet claims EVM
import "npm:@webb-tools/tangle-substrate-types@^0.5.1";
import { ApiPromise, WsProvider } from "npm:@polkadot/[email protected]";
import {
hexToU8a,
stringToU8a,
u8aToHex,
u8aToString,
} from "npm:@polkadot/[email protected]";
import { decodeAddress } from "npm:@polkadot/[email protected]";
import * as ethers from "npm:[email protected]";
@shekohex
shekohex / ark_circom_witness.rs
Created September 27, 2023 07:04
Extended Witness using ark-circom
#[test]
fn extended_witness_circom2() -> Result<()> {
use std::collections::HashMap;
use ark_circom::WitnessCalculator;
let mut wtns = WitnessCalculator::new("./test-vectors/circom2_multiplier2.wasm").unwrap();
let inputs = HashMap::from([
(String::from("a"), vec![4.into()]),
(String::from("b"), vec![5.into()]),
@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