Skip to content

Instantly share code, notes, and snippets.

# Want to cross compile your rust program from your m1 mac to run on aws lambda? do this
rustup target add x86_64-unknown-linux-musl
brew tap messense/macos-cross-toolchains
brew install x86_64-unknown-linux-musl
export CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER=x86_64-unknown-linux-musl-gcc
export CC_x86_64_unknown_linux_musl=x86_64-unknown-linux-musl-gcc

Want to build a PlebClock? You're in the right place!

On your node, do sudo apt install -y figlet jq

then edit the ~/.bashrc file and add this line:

alias plebclock="watch -t -n 10 'date \"+%I : %M\" | figlet -f small; bitcoin-cli getblockcount | figlet -f small; expr 100000000 / $(curl https://api.coindesk.com/v1/bpi/currentprice.json 2>/dev/null | jq -r .bpi.USD.rate | sed s/,// | cut -d . -f 1) | figlet -f small'"
#!/usr/bin/env python
def convertToLinear(x, y, z, xlen=10, ylen=10, zlen=10):
"""
Given a 0-indexed point in zig-zagging 3-space, convert it to an
index in a 0-indexed LED array
"""
assert x < xlen
assert y < ylen
@a5an0
a5an0 / gist:8303298
Created January 7, 2014 17:44
django view to get and render a the most recent *limit* posts on www.alexschoof.com
def post_list(request, limit):
posts_table = get_posts_table()
recent_posts = [x for x in posts_table.query(postType__eq="blog:posts", timePosted__gt=0, limit=limit, reverse=False)]
for post in recent_posts:
post["datetimePosted"] = datetime.datetime.fromtimestamp(post["timePosted"])
return render(request, "post_list.html", {
"posts": recent_posts,
"sitewide_settings": sitewide_settings
})