Skip to content

Instantly share code, notes, and snippets.

@MicahZoltu
MicahZoltu / augur-constant-product.sol
Last active June 25, 2020 01:32
Augur Constant Product
contract AugurConstantProduct {
IAugurMarket market = 0x0;// TODO
IErc20 dai = 0x0; // TODO
uint256 numTicks;
function addLiquidity(uint256 amountInAttodai) {
uint256 poolBalanceBefore = poolBalance();
dai.transferFrom(msg.sender, this, amountInAttodai);
market.buyCompleteSets(amountInAttodai);
@MicahZoltu
MicahZoltu / merkle-patritia-proof.sol
Last active April 1, 2020 06:00
Merkle Patritia Proof Validator in Solidity
pragma solidity 0.6.4;
library RLP {
uint constant DATA_SHORT_START = 0x80;
uint constant DATA_LONG_START = 0xB8;
uint constant LIST_SHORT_START = 0xC0;
uint constant LIST_LONG_START = 0xF8;
uint constant DATA_LONG_OFFSET = 0xB7;
uint constant LIST_LONG_OFFSET = 0xF7;

starting

  1. User has 10 ETH.
  2. User wants 10 ETH worth of an insured YES position.
  3. User buys 10 complete sets, giving them 10 YES + 10 NO + 10 INVALID.
  4. User trades 10 NO for x YES on the open market.
  5. User ends up with 10+x YES + 10 INVALID.
  • If the market resolves as YES, they get 10+x ETH (net profit == x).
  • If the market resolves as NO, they get 0 ETH (net loss == VAR).
  • If the market resolves as INVALID, they get 10 ETH (net neutral).
{
"xhrStatus": "complete",
"request": {
"method": "GET",
"url": "api/datasources/proxy/2/query",
"params": {
"db": "my_database",
"q": "SELECT last(\"number\") FROM \"my_measurement\" WHERE time >= now() - 30m GROUP BY time(1s) fill(previous)",
"epoch": "ms"
},
@MicahZoltu
MicahZoltu / discord.js
Last active October 21, 2021 08:18
Reaction Hotkey for various chat clients.
window.addEventListener('keydown', event => {
if (!event.shiftKey || !event.ctrlKey || event.key != '|') return
const container = document.querySelector('main > div:first-of-type > div:first-of-type > div:first-of-type > ol > li:last-of-type > div')
container.dispatchEvent(new MouseEvent('mousemove', { bubbles: true }));
container.querySelector('div[aria-label="Add Reaction"]').click()
})
@MicahZoltu
MicahZoltu / repro.log
Created July 21, 2018 09:52
restore-repro-logs
This file has been truncated, but you can view the full file.
C:\Program Files\dotnet\sdk\2.1.302\MSBuild.dll -nologo -distributedlogger:Microsoft.DotNet.Tools.MSBuild.MSBuildLogger,C:\Program Files\dotnet\sdk\2.1.302\dotnet.dll*Microsoft.DotNet.Tools.MSBuild.MSBuildForwardingLogger,C:\Program Files\dotnet\sdk\2.1.302\dotnet.dll -maxcpucount -target:Restore -verbosity:m -verbosity:diag tests.csproj
Build started 2018-07-21 17:43:50.
Environment at start of build:
ALLUSERSPROFILE = C:\ProgramData
APPDATA = C:\Users\micah\AppData\Roaming
CommonProgramFiles = C:\Program Files\Common Files
CommonProgramFiles(x86) = C:\Program Files (x86)\Common Files
CommonProgramW6432 = C:\Program Files\Common Files
COMPUTERNAME = MICAH-AIRTOP
ComSpec = C:\WINDOWS\system32\cmd.exe
@MicahZoltu
MicahZoltu / Program.cs
Last active July 21, 2018 09:50
Restore Repro
using System;
namespace App
{
class Program
{
static void Main(String[] args)
{
var program = new Program();
Console.WriteLine(program.Greeting());

Keybase proof

I hereby claim:

  • I am micahzoltu on github.
  • I am micahzoltu (https://keybase.io/micahzoltu) on keybase.
  • I have a public key ASClorQtzJePn4dedMK71QZ6-ilRAz6_Tyb3RKb30sH7jQo

To claim this, I am signing this object:

@MicahZoltu
MicahZoltu / ABI
Created May 22, 2017 09:48
Unexpected Parity Solidity Output
[{"constant":false,"inputs":[{"name":"recoveryDelayInDays","type":"uint8"}],"name":"createWallet","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"walletOwner","type":"address"}],"name":"getWalletFor","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"WalletCreated","type":"event"}]
@MicahZoltu
MicahZoltu / Readme.md
Last active April 27, 2022 16:37
Skyrim Auto-Level Crafting Mod
  1. Install Creation Kit (via Bethesda Launcher).
  2. File > Data > Skyrim.esm
  3. Character > Quests > right click anywhere on right > New
  4. Assign ID, Quest Name, check Start Game Enabled and Run Once
  5. Click OK
  6. Double click new quest in list.
  7. Scripts > Add > New Script
  8. Assign name, Extends Quest, Hidden, OK
  9. Right click script > Edit Source
  10. Paste source.