Skip to content

Instantly share code, notes, and snippets.

@artiya4u
artiya4u / get_txhash.py
Created August 10, 2022 12:02
Get Polkadot txHash by block number and height
# pip install substrate-interface
from substrateinterface import SubstrateInterface
substrate = SubstrateInterface(
url="https://rpc.polkadot.io"
)
block_number = 11542800
number = 2
@artiya4u
artiya4u / talib-install.sh
Last active July 9, 2022 14:29
Install TA-Lib script
#!/usr/bin/env bash
sudo apt install build-essential wget -y
wget https://artiya4u.keybase.pub/TA-lib/ta-lib-0.4.0-src.tar.gz
tar -xvf ta-lib-0.4.0-src.tar.gz
cd ta-lib/
./configure --prefix=/usr
make
sudo make install
@artiya4u
artiya4u / never_second_best.py
Last active March 21, 2022 07:56
เขียนโปรแกรมรับ list ของตัวเลข แล้วให้คืนค่าตัวเลขที่ซ้ำมากที่สุดเป็นอันดับที่ 2 [1, 2, 2] => 1 [1, 2, 2, 3, 3, 3] => 2 [4, 4, 4, 4, 1, 2, 2, 3, 3, 3] => 3
import random
import numpy as np
from collections import defaultdict
import matplotlib.pyplot as plt
from tensorflow import keras
list_size = 10
class_num = 9
import React from 'react';
import {
StyleSheet,
Text,
View,
FlatList,
Dimensions,
TouchableOpacity,
Image,
} from 'react-native';
@artiya4u
artiya4u / README.md
Last active November 6, 2020 15:13 — forked from mrbar42/README.md
bash scripts to create VOD HLS stream with ffmpeg almighty (tested on Linux and OS X) | Vertical video for Nvidia NVENC GPU

running:

bash create-vod-hls.sh beach.mkv

will produce:

    beach/
      |- playlist.m3u8
 |- 360p.m3u8
#!/usr/bin/env python
# This software is Copyright (c) 2017, Dhiru Kholia <dhiru.kholia at gmail.com>
# and it is hereby released to the general public under the following terms:
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted.
#
# Special thanks goes to @Chick3nman for coming up with the output hash format.
#
CREATE TEMPORARY FUNCTION decrypt(_text STRING) RETURNS STRING LANGUAGE js AS
"""
let key = CryptoJS.enc.Utf8.parse("KEY");
let options = { iv: CryptoJS.enc.Utf8.parse("IV"), mode: CryptoJS.mode.CBC };
let _decrypt = CryptoJS.AES.decrypt(_text, key, options).toString(CryptoJS.enc.Utf8);
return _decrypt;
""" OPTIONS (library="gs://crypto-lib/crypto-js.min.js");
SELECT decrypt('ENCRYPTED');
const BNK48CoinCrowdSale = artifacts.require("BNK48CoinCrowdSale");
const BNK48Coin = artifacts.require("BNK48Coin");
const Web3 = require('web3')
function ether(n) {
return new Web3.utils.BN(Web3.utils.toWei(n, 'ether'));
}
module.exports = function (deployer, network, accounts) {
pragma solidity >=0.4.21 <0.7.0;
import "@openzeppelin/contracts/crowdsale/validation/CappedCrowdsale.sol";
import "@openzeppelin/contracts/crowdsale/distribution/RefundableCrowdsale.sol";
import "@openzeppelin/contracts/crowdsale/emission/MintedCrowdsale.sol";
contract BNK48CoinCrowdSale is CappedCrowdsale, RefundableCrowdsale, MintedCrowdsale
{
constructor(uint256 _openingTime, uint256 _closingTime, uint256 _rate, address payable _wallet, uint256 _cap, IERC20 _token, uint256 _goal) public
pragma solidity >=0.4.21 <0.7.0;
import "@openzeppelin/contracts/token/ERC20/ERC20Mintable.sol";
import "@openzeppelin/contracts/ownership/Ownable.sol";
contract BNK48Coin is ERC20Mintable {
string public constant name = "BNK48 COIN"; // solium-disable-line uppercase
string public constant symbol = "BNK48"; // solium-disable-line uppercase