This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# clean everything up | |
echo "killing mongod and mongos" | |
killall mongod | |
killall mongos | |
echo "removing data files" | |
rm -rf data/config | |
rm -rf data/shard* | |
# For mac make sure rlimits are high enough to open all necessary connections | |
ulimit -n 2048 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Dependencies: @tableland/sdk, @tableland/local | |
// Run `npx local-tableland` and then run this script in another window | |
import { Database, helpers } from "@tableland/sdk"; | |
import { Wallet, getDefaultProvider, utils } from "ethers"; | |
// NOTE: using 34000 here to give a 1000 byte padding for the `insert into table values` and | |
// in case the sql parser increases the size, which is unlikely but possible. | |
// If you wanted to limit for gas you'd have to kinda guess a value here. | |
const BYTES_LIMIT = 34000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# you will want to run the hardhat node in a separate terminal | |
# putting this here as a reminder | |
cd evm-tableland | |
npx hardhat node | |
# Add the following to the `networks` prop in hardhat.config.ts | |
# "local-tableland": { | |
# url: "http://127.0.0.1:8545", | |
# accounts: [ | |
# "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias.plog log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=iso --branches |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is a test designed by muller and kahan that demonstrates how | |
// the calculation of a known convergence returns incorrectly because | |
// of the mathematics of floating point numbers | |
const max = 21 | |
let u = 2.0; | |
let v = -4.0; | |
let w; | |
for (let i = 3; i < max; i++) { | |
w = 111.0 - 1130.0/v + 3000.0/(v*u); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>Chain Height</title> | |
<link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet"> | |
</head> | |
<body> | |
<!-- | |
Make sure your Docker daemon is running |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var lim = function (num) { | |
if (num === void 0) num = 100; | |
var series = [100, 50, 25]; | |
var next = function () { | |
var lastTerm = series[series.length - 1]; | |
var secondToLastTerm = series[series.length - 2]; | |
// notice that, since we started above with the first three terms, that the fliping back and forth between adding | |
// and subtracting is handled here ↓, i.e. `secondToLastTerm - lastTerm` is alternating negative and positive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require("express"); | |
const session = require("express-session"); | |
const cors = require("cors"); | |
const app = express(); | |
app.use(cors({ | |
origin: ["http://localhost:3000"], credentials: true | |
} | |
)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// reassigning an argument | |
function argReassign1(a) { | |
a = a || {}; | |
} | |
// not reassigning an argument | |
function argReassign2(a) { | |
if (a === void 0) var a = {}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// --- Dependancies --- | |
var _ = require('underscore'); | |
var mongoose = require('mongoose'); | |
// Any function that makes an update to a mongoose model that has an Array field can | |
// use this to catch version errors, and retry the update at most two times | |
var catchVersionErr = function () { | |
var updateFunc, callback, context, args = _.toArray(arguments); | |
context = args.shift(); |
NewerOlder