Skip to content

Instantly share code, notes, and snippets.

@algochoi
algochoi / pyteal_audit_thoughts.md
Last active October 3, 2022 15:06
PyTeal Good practices for Audits

Writing PyTeal Contracts for audits

Some thoughts to keep in mind when developing PyTeal smart contracts. Hopefully, these points will make it easier for reviewers and auditors to read and understand the contract logic.

Using pragma to enforce a PyTeal compiler version

Since PyTeal is still under active development, there may be bugs fixes or patches in future versions. Although specifying the exact compiler version is likely the best practice, allowing minor version bumps through the caret (^) seems acceptable too.

from pyteal import *
# Enforce a minimum PyTeal compiler version of 0.18.1, 
@usametov
usametov / bash_strict_mode.md
Created August 15, 2021 06:25 — 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
@foone
foone / dam.proto
Created March 1, 2021 17:14
The DAM 3D format of Matterport
// type i
message DAMFile {
repeated Chunk chunk = 1;
repeated QuantizedChunk quantized_chunk = 2;
}
// type "o"
message Chunk {
required Vertices vertices = 1;
required Faces faces = 2;
@prologic
prologic / LearnGoIn5mins.md
Last active May 9, 2024 20:15
Learn Go in ~5mins
@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active June 2, 2024 11:24
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@lillesvin
lillesvin / shplit.sh
Created August 3, 2016 07:22
Command line split timer that optionally uses a file as a pipe. You can have OBS read the contents of that file to display your timer in a video/stream if you don't want to just capture part of the terminal window. You can "split" by hitting Return/Enter (in the terminal) while the timer is running, and stop the timer with Ctrl-C (in the termina…
#!/bin/bash
if [[ "${1}x" == "x" ]]; then
USE_PIPE=false
else
USE_PIPE=true
PIPE=${1}
fi
FORMAT="%s.%2N"
anonymous
anonymous / IRC client in pure bash 4
Created March 28, 2016 16:57
IRC client written in pure bash using only bash builtin commands and no other binaries.
#!/bin/bash
#no PATH, no way to accidently run any programs
PATH=''
#useful variables
term_height=0
term_width=0
term_scroll_height=0
status_line_row=0
@spacecowb0y
spacecowb0y / gource_to_git.sh
Last active September 9, 2021 11:33
From Gource to GIF (Gource and ffmpg are required)
#!/bin/bash
gource --key --seconds-per-day 0.1 --auto-skip-seconds 1 -400x300 -o - | ffmpeg -y -r 60 -f image2pipe -vcodec ppm -i - -vcodec libx264 -preset ultrafast -pix_fmt yuv420p -crf 1 -threads 0 -bf 0 input.mp4
mkdir frames
ffmpeg -i input.mp4 -vf scale=400:-1:flags=lanczos,fps=10 frames/ffout%03d.png
convert -loop 0 frames/ffout*.png output.gif
rm -rf frames