Skip to content

Instantly share code, notes, and snippets.

View HarryR's full-sized avatar
🏴‍☠️
My time travel machine is stuck at 60 seconds per minute

HaRold HarryR

🏴‍☠️
My time travel machine is stuck at 60 seconds per minute
View GitHub Profile
@HarryR
HarryR / kanbanflow-monthly-report.py
Last active September 6, 2024 05:51
Monthly reporting for Kanbanflow, produces a Markdown summary of all tasks and the percentage time breakdown daily & across categories
#!/usr/bin/env python3
import os
import re
import sys
import requests
import calendar
from datetime import datetime, timedelta, date
from typing import TypedDict
from collections import defaultdict
@HarryR
HarryR / triangle.html
Created July 28, 2024 18:12
Draws a cool morphing triangle thing
<!DOCTYPE html>
<html>
<head>
<title>Triangle</title>
</head>
<body>
<canvas id="canvas" width=500 height=500></canvas>
<script>
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract RandomStorage {
mapping(bytes32 => bytes32) internal data;
event ReadEvent(bytes32 k, bytes32 v);
constructor() {}
@HarryR
HarryR / SapphireShuffle.sol
Last active April 23, 2023 18:04
Shuffle a deck of cards on Oasis Sapphire
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
contract SapphireShuffle {
address private constant RANDOM_BYTES = 0x0100000000000000000000000000000000000001;
error ErrorGeneratingRandom();
function _random_bytes32()
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.9;
contract WW
{
event EncryptedResponse(bytes32 nonce, bytes data);
event PublicKey(bytes32 x25519_public);
struct Coupon {
import z3
s = z3.Solver()
bvp = 256
bvs = 2**bvp
balanceOf_signer = z3.BitVec('balanceOf_signer', bvp)
wad = z3.BitVec('wad', bvp)
reward = z3.BitVec('reward', bvp)
contract_balance = z3.Int('contract_balance') # z3.IntVal((10**18) * 4.48)
# Calculate balance of user after performing withdrawal
pragma solidity ^0.8.9;
contract E2Example
{
event EncryptedResponse(bytes32 nonce, bytes data);
event DecryptedInput(uint256 a, uint256 b, uint256 c);
event PublicKey(bytes32 x);
@HarryR
HarryR / download-solc.sh
Created November 23, 2020 17:56
Download solidity compiler
#!/usr/bin/env bash
if [[ -z $1 ]]; then
>&2 echo "Usage: `basename $0` [N.M|latest]"
>&2 echo ""
>&2 echo "Example to download v0.7.2:"
>&2 echo ""
>&2 echo ' $' "`basename $0` 7.2"
>&2 echo ""
>&2 echo "Example to download latest version:"
@HarryR
HarryR / signal.hpp
Created December 9, 2019 17:16
Tiny declarative signals / event hooks for C++11
#pragma once
#include <functional>
template<typename... ArgsT>
struct EventHook;
template<typename... ArgsT>
/// Conditionally enable a function if they share the same CurveT type
/// e.g. template<IsSameCurve<CurveT,OtherType> = 0>
template<typename MyCurve, typename OtherType>
using IsSameCurve = std::enable_if_t<std::is_same<MyCurve,typename OtherType::CurveT>::value,int>;
/// Conditionally enable a function if the are of the same types and curves
/// Uses CanonicalSelfT to determine if they're the same general type
/// e.g. template<IsSameCurve<CurveT,OtherType> = 0>