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
@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;
@ilovelili
ilovelili / git-clear-history.sh
Created August 9, 2020 07:03
git clear history
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin git@github.com:<YOUR ACCOUNT>/<YOUR REPOS>.git
pragma solidity ^0.4.10;
// Enables event logging of the format `console.log('descriptive string', variable)`,
// without having to worry about the variable type (as long as an event has been declared for that type in the
// Console contract.
contract Console {
event LogUint(string, uint);
function log(string s , uint x) {
LogUint(s, x);