Skip to content

Instantly share code, notes, and snippets.

View arshamalh's full-sized avatar
:octocat:
This Octacat is my pet!

Mohammad Reza Karimi arshamalh

:octocat:
This Octacat is my pet!
View GitHub Profile
@motopig
motopig / tron_address_generate.go
Created December 5, 2019 05:57
tron address generate
package main
import (
"crypto/ecdsa"
"crypto/sha256"
"encoding/hex"
"fmt"
"log"
"github.com/mr-tron/base58"
# Read more about setting it up
# https://medium.com/@ljmocic/deploying-react-application-to-aws-s3-using-github-actions-85addacaeace
on:
push:
tags:
- '*'
jobs:
build:
@arshamalh
arshamalh / erc20_balance.go
Last active February 17, 2024 07:30
Finding ETH erc20 tokens balance using golang and infura.io
/// Import on the top of your project
import "github.com/ethereum/go-ethereum/crypto"
type ethHandlerResult struct {
Result string `json:"result"`
Error struct {
Code int64 `json:"code"`
Message string `json:"message"`
} `json:"error"`
}
@arshamalh
arshamalh / erc20_balance.js
Created June 19, 2021 07:37
Finding ETH erc20 tokens balance using JavaScript and infura.io
const infuraProjectID = "Write your infura projectID here" // https://infura.io/signup
const tokenContractAddress = "0xdac17f958d2ee523a2206206994597c13d831ec7"
const accountAddress = "0x757d576da3fba018b1bd9cdd05fa4ca0261792c8"
// Dependencies
const Web3 = require('web3');
const web3 = new Web3()
const keccak_256 = require('js-sha3').keccak256
const rp = require('request-promise')
const retry = require('async-retry')
@maratori
maratori / golang-mocks.md
Last active April 15, 2025 05:19
Comparison of golang mocking libraries

Comparison of golang mocking libraries

Updated 2025-04-13

[gomock][1] [testify][2] + [mockery][3] [mockio][4] [minimock][5] [moq][6]

Library

GitHub stars [![s1]][1] [![s2]][2] + [![s3]][3] [![s4]][4] [![s5]][5] [![s6]][6]
Latest release date [![d1]][r1] [![d2]][r2] + [![d3]][r3] [![d4]][r4] [![d5]][r5] [![d6]][r6]
Maintained
@arshamalh
arshamalh / getBearerToken.js
Created November 10, 2021 11:23
Twitter OAuth 2.0 Get Bearer Token
// npm install got, dotenv
const got = require('got');
require('dotenv').config();
const credentials = process.env.CONSUMER_TOKEN + ":" + process.env.CONSUMER_SECRET
const credentialsBase64Encoded = new Buffer.from(credentials).toString('base64');
got({
url: 'https://api.twitter.com/oauth2/token',
method:'POST',
@arshamalh
arshamalh / pgCursorPagination.js
Created December 13, 2021 07:03
Cursor pagination in PostgreSQL and Nodejs
// Written by Arsham Arya
// I'm not sure it's the best way,
// So any contribution makes me and other readers happy :)
import pgPromise from "pg-promise";
import Cursor from "pg-cursor";
require("dotenv").config();
const pgp = pgPromise();
@arshamalh
arshamalh / uniqueArrayElement.sql
Last active December 23, 2021 08:15
Postgres making arrays taking unique elements
-- Written by Arsham Arya
-- Any contribution makes readers happy.
INSERT INTO table_name (user_id, my_array_field)
VALUES (2233, array[112, 333])
ON CONFLICT (user_id) DO
UPDATE SET my_array_field = array(
SELECT DISTINCT unnest(table_name.my_array_field || array[112, 333])
) WHERE table_name.user_id = 2233;
@arshamalh
arshamalh / pgCursorPagination.py
Created December 23, 2021 09:40
Cursor pagination in PostgreSQL and Python
# Written by Arsham Arya
# I'm not sure it's the best way,
# So any contribution makes me and other readers happy :)
from psycopg2.pool import ThreadedConnectionPool
import config
_CONNECTION_POOL = None
@arshamalh
arshamalh / contact_book.py
Created January 15, 2022 09:12
simple Tkinter contact book.
from tkinter import *
from tkinter import messagebox
root = Tk()
root.geometry("480x170")
root.title("Raha Contacts books")
Name = StringVar()
Number = StringVar()
Address = StringVar()