A custom React Hook that allows you to call a callback after a specified delay.
import { useTimeout } from './useTimeout';
const callback = () => {
// exporting from a bs58 private key to an Uint8Array | |
// == from phantom private key to solana cli id.json key file | |
// npm install bs58 @solana/web3.js | |
const web3 = require("@solana/web3.js"); | |
const bs58 = require('bs58'); | |
let secretKey = bs58.decode("[base58 private key here]"); | |
console.log(`[${web3.Keypair.fromSecretKey(secretKey).secretKey}]`); | |
// exporting back from Uint8Array to bs58 private key |
javascript:document.querySelectorAll('div.segment-start-offset').forEach(r => r.remove()) |
var Gpio = require('onoff').Gpio; //include onoff to interact with the GPIO | |
var LED = new Gpio(4, 'out'); //use GPIO pin 4, and specify that it is output | |
var blinkInterval = setInterval(blinkLED, 250); //run the blinkLED function every 250ms | |
function blinkLED() { //function to start blinking | |
if (LED.readSync() === 0) { //check the pin state, if the state is 0 (or off) | |
LED.writeSync(1); //set pin state to 1 (turn LED on) | |
} else { | |
LED.writeSync(0); //set pin state to 0 (turn LED off) | |
} |
A smart contract for a Todo App on the Ethereum blockchain.
TaskContract is a smart contract for a Todo App on the Ethereum blockchain. It allows users to add tasks and delete tasks. It also allows users to view their own tasks.
TaskContract has the following functions:
addTask(string memory taskText, bool isDeleted)
- adds a new task to the contract.// Function to pad a given key to a length of 32 bytes using the CryptoJS library | |
function padKey(e) { | |
// Convert the input string 'e' to a UTF-8 encoded WordArray | |
let t = CryptoJS.enc.Utf8.parse(e); | |
// Create an empty WordArray to store the padded key | |
let n = CryptoJS.lib.WordArray.create(); | |
// Concatenate the UTF-8 encoded WordArray 't' to 'n' | |
n.concat(t); |
{ | |
"version": "0.1.0", | |
"name": "pump", | |
"instructions": [ | |
{ | |
"name": "initialize", | |
"docs": [ | |
"Creates the global state." | |
], | |
"accounts": [ |
OX_API_KEY= | |
OX_API_SECRET= |