Skip to content

Instantly share code, notes, and snippets.

View ilovelili's full-sized avatar
🏠
Working from home

min ju ilovelili

🏠
Working from home
View GitHub Profile
curl "https://api.woodstock.club/user" \
-X PUT \
-d "{\"name\":\"min ju\",\"handler\":\"mj_cool\",\"description\":\"mj is a very cool guy\"}" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Im05Rk5kTEdQTGsxb05XbkF6Q0x6diJ9.eyJuaWNrbmFtZSI6ImNvbnRhY3QiLCJuYW1lIjoiY29udGFjdEB3b29kc3RvY2suY2x1YiIsInBpY3R1cmUiOiJodHRwczovL3MuZ3JhdmF0YXIuY29tL2F2YXRhci83ZDk2N2RlZWYzZGNjN2FjMTQ4MzZlYzg0ZmUzYjdkMD9zPTQ4MCZyPXBnJmQ9aHR0cHMlM0ElMkYlMkZjZG4uYXV0aDAuY29tJTJGYXZhdGFycyUyRmNvLnBuZyIsInVwZGF0ZWRfYXQiOiIyMDIxLTAyLTI4VDE0OjM2OjExLjgxM1oiLCJlbWFpbCI6ImNvbnRhY3RAd29vZHN0b2NrLmNsdWIiLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6Ly93b29kc3RvY2suanAuYXV0aDAuY29tLyIsInN1YiI6ImF1dGgwfDYwMWU0MTNhNGZhNjAxMDA2YWQwODhiNyIsImF1ZCI6ImdJNlExT3FUdEFTcFhoSXQ3U0c1REhWQWU4UnlKZ2ZQIiwiaWF0IjoxNjE0NTkxNzMyLCJleHAiOjE2MTYwMzE3MzJ9.x5QMf-AK9t1RiWzvDTj5-A6_5sIneLmAEO2TRl4iV9bwbXkV36maNxcdFGgk4dJtPLzKkCxCNXK_pMnARgXJ6mAR-bVlaaIB6A7P8VVXTOdiPVHdjY_8lJW6CncSwkp9IbD3s9Te2WwRVK0c78Ba1
const { ethers } = require("ethers");
const provider = new ethers.providers.JsonRpcProvider("http://0.0.0.0:8545");
// https://info.uniswap.org/pair/0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc
const uniswapUsdtWethExchange = "0xB4e16d0168e52d35CaCD2c6185b44281Ec28C9Dc";
// this ABI object works for both Uniswap and SushiSwap
const uniswapAbi = [
"event Swap(address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to)",
];
@ilovelili
ilovelili / client.html
Created December 8, 2020 12:30 — forked from agrueneberg/client.html
HMAC-SHA256 example for verifying both the data integrity and the authentication of a request in Node.js and web browsers.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>HMAC-SHA256 Example</title>
</head>
<body>
<script src="http://crypto.stanford.edu/sjcl/sjcl.js"></script>
<script>
var sharedSecret, query, signature, hmac, xhr;
@ilovelili
ilovelili / ipfs-server-setup.md
Created November 22, 2020 10:08 — forked from claus/ipfs-server-setup.md
Host Your Site Under Your Domain on IPFS

Host Your Site Under Your Domain on IPFS

This is a step-by-step tutorial for hosting your website under your domain on IPFS, from zero, on a DigitalOcean Ubuntu 16.04.3 x64 Droplet (i am using the $10 variant with 2GB RAM).

Install IPFS

Log in as root.

First, make sure the system is up to date, and install tar and wget:

@ilovelili
ilovelili / gist:38145eb5c3ac8e81cc2f81d8e2440f8c
Created November 22, 2020 07:42
set up IPFS systemd service
#!/bin/bash
#pick your IPFS version
VERS=0.7.0
DIST="go-ipfs_v${VERS}_linux-amd64.tar.gz"
sudo apt-get update
sudo apt-get install golang-go -y
wget https://dist.ipfs.io/go-ipfs/v0.4.13/$DIST
tar xvfz $DIST
require("dotenv").config();
const {ethers} = require("ethers");
const HDWalletProvider = require("@truffle/hdwallet-provider");
const infuraUri = process.env.INFURA_URI || "";
const infuraTestnetUri = process.env.INFURA_TESTNET_URI || "";
const privKey = process.env.PRIVATE_KEY || "";
module.exports = {
networks: {
<html>
<body>
<script>
function leapYear(year) {
return (year % 4 == 0 && year % 100 != 0) || year % 400 == 0;
}
function checkDaysinMonth(month) {
const year = new Date().getFullYear();
<html>
<head>
<title>kaka learns JS</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" />
<style>
span {
color: purple;
}
</style>
</head>
@ilovelili
ilovelili / kaka
Created September 25, 2020 14:23
const c = (x) => console.log(x);
// Declare a variable named challenge and assign it to an initial value '30 Days Of JavaScript'
let cha = "30 Days Of JavaScript";
// What is the character code of J in '30 Days Of JavaScript' string using charCodeAt()
const index = cha.indexOf("J");
c(cha.charCodeAt(index));
@ilovelili
ilovelili / storage vs memory
Created August 30, 2020 12:33
solidity storage vs memory
// SPDX-License-Identifier: ISC
pragma solidity ^0.7.0;
contract Storage {
struct Test {
uint256 id;
uint256 count;
}
uint256 public storageId;