Skip to content

Instantly share code, notes, and snippets.

@hrkrshnn
hrkrshnn / generic.org
Last active May 27, 2022
Some generic writeup about common gas optimizations, etc.
View generic.org

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
@sorny
sorny / x11_forwarding_macos_docker.md
Last active May 23, 2022
X11 forwarding with macOS and Docker
View x11_forwarding_macos_docker.md

X11 forwarding on macOS and docker

A quick guide on how to setup X11 forwarding on macOS when using docker containers requiring a DISPLAY.

This guide was tested on:

  • macOS Catalina 10.15.4
  • docker desktop 2.2.0.5 (43884) - stable release
  • XQuartz 2.7.11 (xorg-server 1.18.4)

Step-By-Step Guide

@bgauduch
bgauduch / multiple-repository-and-identities-git-configuration.md
Last active May 26, 2022
Git config with multiple identities and multiple repositories
View multiple-repository-and-identities-git-configuration.md

Setup multiple git identities & git user informations

/!\ Be very carrefull in your setup : any misconfiguration make all the git config to fail silently ! Go trought this guide step by step and it should be fine 😉

Setup multiple git ssh identities for git

  • Generate your SSH keys as per your git provider documentation.
  • Add each public SSH keys to your git providers acounts.
  • In your ~/.ssh/config, set each ssh key for each repository as in this exemple:
View compose-datomic-queries.md

I was struggling to compose datomic queries neatly. In the end I googled and found a blogpost which proposed a sane solution.

My motivation was an API endpoint with optional filters. I'd like my query include additional filters based on the args present.

Anyway, here's how my code ended up looking...

And the article: http://grishaev.me/en/datomic-query

@gilbertw1
gilbertw1 / mu-index-notify.sh
Last active Jan 6, 2021
A simple script that re-indexes emails using mu and sends a notification if new emails are detected.
View mu-index-notify.sh
# puts timestamps into an easily comparable format
extract_timestamp() {
local RAW="$(echo "$1" | cut -c1-31)"
echo "$(date --date="$RAW" '+%Y-%m-%d:%H:%M:%S')"
}
# removes html characters that are interpreted poorly by dunst
format_string() {
echo "$1" | sed 's/>/\&gt;/' | sed 's/</\&lt;/' | sed 's/\$/\\$/'
}
@unsalted
unsalted / sierra-hackintosh-z170-a.md
Last active Jun 4, 2021
Sierra 10.12.3 Hackintosh | Asus z170-A, Intel i5 6500, MSI GTX 960 OC, GTX1070(Dormant)
View sierra-hackintosh-z170-a.md

Sierra 10.12.3 Hackintosh

This is my build documentation for an ASUS Z170-A setup with an NVIDIA GTX960 and the Intel i5 6500, most of this came from Storks asus rog maximus build, his audio instructions didn't work for me so it differs substantially there. This build also doesn't have NVRAM. Nearest I can tell everything is running as expected, including all USB and audio ports.

Build

  • Asus Z170-A
  • Intel Core i5-6500
  • Crucial Ballistix Sport LT 32GB (2 x 16GB) DDR4-2400 Memory
  • MSI GeForce GTX 960 4GB Installed in slot 1!
@arbelt
arbelt / init.lua
Created Oct 2, 2016
Hammerspoon config to send escape on short ctrl press
View init.lua
ctrl_table = {
sends_escape = true,
last_mods = {}
}
control_key_timer = hs.timer.delayed.new(0.15, function()
ctrl_table["send_escape"] = false
-- log.i("timer fired")
-- control_key_timer:stop()
end
@karlhorky
karlhorky / pr.md
Last active Dec 1, 2021 — forked from piscisaureus/pr.md
Fetch all GitHub pull requests to local tracking branches
View pr.md

NOTE

You may not need local branches for all pull requests in a repo.

To fetch only the ref of a single pull request that you need, use this:

git fetch origin pull/7324/head:pr-7324
git checkout pr-7324
# ...
View functions.sh
# GIT heart FZF
# -------------
is_in_git_repo() {
git rev-parse HEAD > /dev/null 2>&1
}
fzf-down() {
fzf --height 50% --min-height 20 --border --bind ctrl-/:toggle-preview "$@"
}