Skip to content

Instantly share code, notes, and snippets.

@sambacha
sambacha / Dockerfile
Last active January 25, 2021 20:56 — forked from armand1m/Dockerfile
Yarn cache compatible Dockerfile
FROM alpine
RUN apk add --update --no-cache nodejs
RUN npm i -g yarn
ADD package.json yarn.lock /tmp/
ADD .yarn-cache.tgz /
RUN cd /tmp && yarn
RUN mkdir -p /service && cd /service && ln -s /tmp/node_modules
@sambacha
sambacha / bash_strict_mode.md
Created October 5, 2020 10:20 — forked from mohanpedala/bash_strict_mode.md
set -e, -u, -o pipefail explanation

set -e, -u, -o 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 -euo pipefail is short for:

set -e
set -u
@sambacha
sambacha / EXAMPLES.md
Last active October 7, 2020 07:15 — forked from DarrenN/get-npm-package-version
Extract version from package.json (NPM) using bash / shell

No need for sed or grep here. I solved the issue in a deploy script with

awk '/version/{gsub(/("|",)/,"",$2);print $2};' package.json

here's a stupid but fun way w/o awk or sed

grep version package.json | cut -c 15- | rev | cut -c 3- | rev

Cheers

@sambacha
sambacha / report.sh
Created October 13, 2020 09:43 — forked from whalemare/report.sh
Bash script for generate daily-report
#!/bin/bash
# Daily report bash script
# This generate daily-report file for project, where it .sh will be executed
# For use move it to your project folder and exec in terminal:
# +x ; ./report.sh
DEBUG=0
directoryName="reports"
getName() {
@sambacha
sambacha / dicekey-wordlist-14400.txt
Created October 15, 2020 15:07 — forked from atoponce/dicekey-wordlist-14400.txt
14,400 word list for the DiceKey
AB1N a
AB1E aah
AB1S abacus
AB1W abide
AB2N able
AB2E abroad
AB2S absurd
AB2W acadia
AB3N ace
AB3E aced
@sambacha
sambacha / ssh-tgzx
Created November 3, 2020 09:40 — forked from nicerobot/ssh-tgzx
Self-extracting, encrypted tarballs using SSH public keys from GitHub. Because https://ssh-vault.com is awesome but it requires an installation.
#!/bin/bash
(( ${#} >= 3 )) || { echo "usage: $(basename ${0}) github-username archive-file [files | directories]"; exit 1; }
exec >${2}
zero='${0}'
cat <<SCRIPT
#!/usr/bin/env bash
usage() {
echo "usage: bash ${zero} identity-file"
contract PatriciaTree {
// List of all keys, not necessarily sorted.
bytes[] keys;
// Mapping of hash of key to value
mapping (bytes32 => bytes) values;
struct Label {
bytes32 data;
uint length;
}
@sambacha
sambacha / 0-TLDR.md
Created November 11, 2020 04:33 — forked from RichardBronosky/0-TLDR.md
How to easily launch a temporary one-off git server from any local repository, to enable a peer-to-peer git workflow.

User 1

remote_server=172.31.0.1
git daemon --verbose --export-all --base-path=.git --reuseaddr --strict-paths .git/ > /tmp/git-serve.log 2>&1 &
ssh -R 9418:localhost:9418 ec2-user@$remote_server
git clone git://localhost/ local-repo-name

Repo from workstation is cloned onto server.

User 2

@sambacha
sambacha / tree_sitter_guide.md
Last active November 12, 2020 09:03 — forked from Aerijo/tree_sitter_guide.md
Guide to writing your first Tree-sitter grammar

Guide to your first Tree-sitter grammar

NOTE: The Tree-sitter API and documentation has changed and improved since this guide was created. I can't guarantee this is up to date.

About

Tree-sitter is the new way Atom is providing language recognition features, such as syntax highlighting, code folding, autocomplete, and more. In contrast to TextMate grammars, which work by regex matching, Tree-sitter will generate an entire syntax tree. But more on that can be found in it's own docs.

Here, we look at making one from scratch.

key value
0x0000000484f2217f1a64eb6d24b5cee446faeae5 68.69048107855006
0x000006eee6e39015cb523aebdd4d0b1855aba682 224.9197902100917
0x0000a441fbb1fbaadf246539bf253a42abd31494 708.9370225453673
0x0004d2a2f9a823c1a585fde6514a17ff695e0001 17266.765333736228
0x0006e4548aed4502ec8c844567840ce6ef1013f5 175.35113630869478
0x000b75fcdc15d41277deb033c72d2c8d774ccced 2.0369790054406494
0x000d7321f6767c3910bbce248cb9df5c8eb0edf9 14.229752092760547
0x0037f3deb586d1b34abaae92341f9bb70527a4d4 940.0786947880968
0x0053b5daa6d4c2e3d16f2b9c10dc04e92b14a818 0.2089564825243452