Skip to content

Instantly share code, notes, and snippets.

View shogochiai's full-sized avatar
🚀
coding

Shogo Ochiai shogochiai

🚀
coding
View GitHub Profile
@shogochiai
shogochiai / ethresearch-localizer.js
Last active April 12, 2018 14:44
Fetch ethresear.ch to local. Because I wanna put it on newtab on chrome and I wanna render it faster.
/*
* Minimum requirement: NodeJS 8.0.0
* Put `*/15 * * * * /path/to/wget https://ethresear.ch -O /tmp/ethresear.ch >/tmp/stdout.log 2>/tmp/stderr.log && /path/to/node /path/to/ethresearch-localizer.js`
*/
const cheerio = require('cheerio')
const fs = require('fs')
const LOCAL_FILE = "/tmp/ethresear.ch"
const html = fs.readFileSync(LOCAL_FILE)
const $ = cheerio.load(html)
@shogochiai
shogochiai / merkle.ex
Last active September 5, 2018 11:34
MerkleProof learning purpose
defmodule MerkleTree.Node do
@moduledoc """
This module implements a tree node abstraction.
"""
defstruct [:value, :children, :height]
@type t :: %__MODULE__{
value: String.t,
children: [MerkleTree.Node.t],
#!/bin/bash
# For
# - ubuntu18.04
# - t2.medium
# - Security Rule: port 22,25,80,443
# - EBS 16GB
# - Discourse v2.3.0.beta9
# - Amazon SES
# - bash ./discourse-build.sh forum bitcoin.com AKKSISNHFDCVBPDEOJBN BCokAid4stoJaOKSqnRJXpwJKKSvuA7thhomFajjKAp/
#!/bin/bash
# Discussion, issues and change requests at:
# https://github.com/nodesource/distributions
#
# Script to install the NodeSource Node.js 13.x repo onto a
# Debian or Ubuntu system.
#
# Run as root or insert `sudo -E` before `bash`:
#
@shogochiai
shogochiai / addr2hex.js
Created May 3, 2020 04:45
For Tezos with ConseilJS
const conseil = require('conseiljs');
require('dotenv').config();
(async _=>{
const addr = await conseil.TezosMessageUtils.writeAddress(process.argv[process.argv.length - 1])
console.log(`${process.argv[process.argv.length - 1]} to 0x${addr}`)
console.log("Put it to .env")
})()
@shogochiai
shogochiai / Borrow.sol
Created August 29, 2024 05:43
An example of collocated fuzz test with meta contract. To get complex generated code, one can copy-paste this file to MC GPT and then test each validations by the unit tests.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import {Schema} from "bundle/main/storage/Schema.sol";
import {Storage} from "bundle/main/storage/Storage.sol";
import {MCTest} from "@devkit/Flattened.sol"; // MCTestをインポート
contract Borrow {