This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// 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"` | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tkinter import * | |
from tkinter import messagebox | |
root = Tk() | |
root.geometry("480x170") | |
root.title("Raha Contacts books") | |
Name = StringVar() | |
Number = StringVar() | |
Address = StringVar() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Compound unique indexs are indexes made of multiple columns together. | |
# For example if we have this data: | |
""" | |
("arsham", 930) | |
""" | |
# We can have ("arsham", 920), ("arsham", 910), Also we can have ("atousa", 930) | |
# but we can't have ("arsham", 930) again. | |
# I hope I explained it well enough. 😊 | |
from pymongo import MongoClient, ASCENDING |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Written by Arsham Arya | |
I'm not sure it's the best way, | |
So any contribution makes everyone happy! | |
""" | |
# pip install requests | |
from requests import get | |
# Config is can is a dictionary of ENV variables including TMDB_API_KEY | |
# https://gist.github.com/arshamalh/16a42854cb43bbe48038c7431529a552 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Written by Arsham Arya | |
I'm not sure it's the best way, | |
So any contribution makes everyone happy! | |
""" | |
from os import environ | |
# pip install python-dotenv | |
from dotenv import dotenv_values |
OlderNewer