This gist was deprecated and promoted into a real repository!
Please see: https://github.com/wmitsuda/one-liner-archive
This gist was deprecated and promoted into a real repository!
Please see: https://github.com/wmitsuda/one-liner-archive
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.9; | |
// Unlike the string type, ShortString is a value type that can be made immutable. | |
// It supports strings of at most 32 bytes and assumes they don't contain null bytes. | |
type ShortString is bytes32; | |
error StringTooLong(string s); |
/// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 | |
/// @param a The multiplicand | |
/// @param b The multiplier | |
/// @param denominator The divisor | |
/// @return result The 256-bit result | |
/// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv | |
function mulDiv( | |
uint256 a, | |
uint256 b, | |
uint256 denominator |
package main | |
import ( | |
"fmt" | |
"math/big" | |
) | |
func main() { | |
s := "a" | |
i := new(big.Int) |
import ( | |
"context" | |
"fmt" | |
"os" | |
"time" | |
"github.com/dgraph-io/badger" | |
) | |
const ( |
brew install -v apparix | |
# Installed to: /opt/foo/Cellar/apparix/11-0/bin/apparix | |
# Add bm/to Bash functions from man page to .bashrc or .local.bash: | |
man -P cat apparix | awk '/BASH-style functions/{p=1} /---/{if(p==1)p=2; else p=0; next} p>1{print}' >> ~/.local.bash | |
# Reload my bash config: | |
source ~/.local.bash | |
# Now create a bookmark: |
A slightly updated version of this doc is here on my website.
I visited with PagerDuty yesterday for a little Friday beer and pizza. While there I got started talking about Go. I was asked by Alex, their CEO, why I liked it. Several other people have asked me the same question recently, so I figured it was worth posting.
The first 1/2 of Go's concurrency story. Lightweight, concurrent function execution. You can spawn tons of these if needed and the Go runtime multiplexes them onto the configured number of CPUs/Threads as needed. They start with a super small stack that can grow (and shrink) via dynamic allocation (and freeing). They are as simple as go f(x)
, where f()
is a function.