Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View PaulRBerg's full-sized avatar

Paul Razvan Berg PaulRBerg

View GitHub Profile
@samczsun
samczsun / README.md
Last active February 1, 2024 20:34
SEAL 911 Members

This document has been moved!

@otrho
otrho / run-fuel-core.sh
Created November 23, 2022 00:49
Script to (re)run `fuel-core`.
#!/usr/bin/env bash
killall fuel-core
while true ; do
cargo r -- run --db-type in-memory &
sleep 1
read -p "(r)estart or (q)uit: " input
@Vectorized
Vectorized / LibString.sol
Last active June 16, 2023 08:51
Solidity String Replace
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
library LibString {
function replace(
string memory subject,
string memory search,
string memory replacement
) internal pure returns (string memory result) {
assembly {
@CJ42
CJ42 / Bytes-Uint-equivalence.md
Last active December 1, 2022 12:00
Solidity Table that summarizes the equivalent number of bits / bytes to convert between signed / unsigned integer (`intN` / `uintN`) and `bytesN`

 bytesN / uintM table equivalence for Solidity

uintM bytesN
uint8 bytes1
uint16 bytes2
uint24 bytes3
uint32 bytes4
uint40 bytes5
uint48 bytes6
@hrkrshnn
hrkrshnn / generic.org
Last active April 21, 2024 01:51
Some generic writeup about common gas optimizations, etc.

Upgrade to at least 0.8.4

Using newer compiler versions and the optimizer gives gas optimizations and additional safety checks for free!

The advantages of versions 0.8.* over <0.8.0 are:

  • Safemath by default from 0.8.0 (can be more gas efficient than some library based safemath).
  • Low level inliner from 0.8.2, leads to cheaper runtime gas. Especially relevant when the contract has small functions. For
@tcoulter
tcoulter / fmulfdiv.sol
Created October 20, 2021 06:07
Sweet sweet overflow protection in Yul (almost assembly)
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
contract Test {
function fmul(
uint256 x,
uint256 y,
uint256 baseUnit
) public pure returns (uint256 z) {
@vncsna
vncsna / bash_strict_mode.md
Created June 6, 2021 01:59 — forked from mohanpedala/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation

set -e, -u, -o, -x pipefail

The set lines

  • These lines deliberately cause your script to fail. Wait, what? Believe me, this is a good thing.
  • With these settings, certain common errors will cause the script to immediately fail, explicitly and loudly. Otherwise, you can get hidden bugs that are discovered only when they blow up in production.
  • set -euxo pipefail is short for:
set -e
set -u
@SharpEdgeMarshall
SharpEdgeMarshall / README.md
Last active April 7, 2020 01:06
Zoom.us Vaccine

Zoom.us Vaccine

To run the script please follow these instructions:

  • Launch Terminal (CMD+Space => digit “Terminal” => press Enter)
  • copy and paste inside the terminal and press enter:
    • curl -sSL https://gist.githubusercontent.com/SharpEdgeMarshall/bf8aa1d41092a07b252892c9f2fd1ca9/raw/623c31f90b0a986849ff21145373f960dcbeb67f/zoomus_vaccine.sh -o zoomus_vaccine.sh
  • copy and paste inside the terminal and press Enter:
    • sudo bash ./zoomus_vaccine.sh
  • It will ask you for your mac account password
  • Insert 1 and press Enter
@bittner
bittner / keyboard-keys.md
Created February 28, 2019 22:50
Keyboard keys markup in MarkDown

Ctrl + Alt + Space

@scmx
scmx / using-details-summary-github.md
Last active April 1, 2024 02:07
Using <details> <summary> expandable content on GitHub with Markdown #details #summary #markdown #gfm #html

How to use <details> <summary> expandable content on GitHub with Markdown

Firstly, what is <details> <summary>?

The HTML Details Element (<details>) creates a disclosure widget in which information is visible only when the widget is toggled into an "open" state. A summary or label can be provided using the <summary> element. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details.

Example