Note:
<example>is meant to denote text replaced by you (including brackets).
// global dependencies
npm install -g knex| const crypto = require('crypto'); | |
| const algorithm = 'aes-256-ctr'; | |
| let key = 'MySuperSecretKey'; | |
| key = crypto.createHash('sha256').update(String(key)).digest('base64').substr(0, 32); | |
| const encrypt = (buffer) => { | |
| // Create an initialization vector | |
| const iv = crypto.randomBytes(16); | |
| // Create a new cipher using the algorithm, key, and iv | |
| const cipher = crypto.createCipheriv(algorithm, key, iv); |
| pragma solidity ^0.7.0; | |
| import {SafeMath} from '@openzeppelin/contracts/math/SafeMath.sol'; | |
| import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; | |
| import {IUniswapV2Router02} from '@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol'; | |
| interface IWETH9 { | |
| function deposit() external payable; | |
| } |
| // Example usage | |
| import { sequence } from './sequence.mjs' | |
| import cssModules from "svelte-preprocess-cssmodules"; | |
| export default { | |
| preprocess: sequence([sveltePreprocess(), cssModules()]), | |
| } |
| // We require the Hardhat Runtime Environment explicitly here. This is optional | |
| // but useful for running the script in a standalone fashion through `node <script>`. | |
| // | |
| // When running the script with `hardhat run <script>` you'll find the Hardhat | |
| // Runtime Environment's members available in the global scope. | |
| const hre = require("hardhat"); | |
| async function main() { | |
| // Hardhat always runs the compile task when running scripts with its command | |
| // line interface. |
| import ethers, { | |
| Contract, | |
| providers as Providers, | |
| utils as Utils, | |
| Wallet, | |
| ContractFactory | |
| } from "ethers" | |
| import path from "path" | |
| import fs from "fs" |
| // SPDX-License-Identifier: MIT | |
| pragma solidity =0.7.6; | |
| pragma abicoder v2; | |
| import "https://github.com/Uniswap/uniswap-v3-periphery/blob/main/contracts/interfaces/ISwapRouter.sol"; | |
| import "https://github.com/Uniswap/uniswap-v3-periphery/blob/main/contracts/interfaces/IQuoter.sol"; | |
| import {IERC20, SafeERC20} from "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.4-solc-0.7/contracts/token/ERC20/SafeERC20.sol"; | |
| interface IUniswapRouter is ISwapRouter { |
| var Promise = require('bluebird'); | |
| var funcs = Promise.resolve([500, 100, 400, 200].map((n) => makeWait(n))); | |
| funcs | |
| .each(iterator) // logs: 500, 100, 400, 200 | |
| .then(console.log) // logs: [ [Function], [Function], [Function], [Function] ] | |
| funcs | |
| .mapSeries(iterator) // logs: 500, 100, 400, 200 |
| # Luke's config for the Zoomer Shell | |
| # Enable colors and change prompt: | |
| autoload -U colors && colors | |
| PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b " | |
| # History in cache directory: | |
| HISTSIZE=10000 | |
| SAVEHIST=10000 | |
| HISTFILE=~/.cache/zsh/history |
| #!/usr/bin/node | |
| // use puppeteer 0.12.0 | |
| // since puppeteer has problems in socks5 | |
| // use polipo as a http proxy, which parent proxy is tor (localhost:9050) | |
| var time = require('time'); | |
| var sleep = require('sleep'); | |
| const random_max = 10; |