Skip to content

Instantly share code, notes, and snippets.

@roppa
roppa / crypto.go
Created March 28, 2022 15:38 — forked from miguelmota/crypto.go
Golang SHA256 hash example
package crypto
import (
"crypto/sha256"
)
// NewSHA256 ...
func NewSHA256(data []byte) []byte {
hash := sha256.Sum256(data)
return hash[:]
@roppa
roppa / tez
Last active October 18, 2021 16:19
I am attesting that this GitHub handle roppa is linked to the Tezos account tz1iC7UNquWbwf24kW3sGdVtYCNE5EzmTSkT for tzprofiles
@roppa
roppa / vscode-update-permission-denied.txt
Created June 5, 2020 22:26 — forked from iamcryptoki/vscode-update-permission-denied.txt
Fix Visual Studio Code update error "Could not create temporary directory: Permission denied" on macOS.
sudo rm -Rf ~/Library/Caches/com.microsoft.VSCode.ShipIt
sudo rm -Rf ~/Library/Caches/com.microsoft.VSCodeInsiders.ShipIt
@roppa
roppa / javscript.code-snippets.js
Last active February 10, 2020 10:36
VSCode Test Snippets
{
// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
// Example:
// "Print to console": {
// "scope": "javascript,typescript",
@roppa
roppa / game-of-life.js
Last active August 29, 2019 08:58
Game of life experiment
/**
Quick POC for game of life. Terrible side effects. Actually doing this in Rust but wanted to quickly knock something out in js
**/
let width = 40
function getCells() {
return new Array(width * width).fill(false)
}
let cells = getCells()
@roppa
roppa / pullrepos.sh
Created December 12, 2018 16:33
Git pull origin master in folder containing many git repos
#!/bin/bash
for f in $PWD/*;
do
[ -d $f ]
cd "$f"
echo $f
git pull origin master
done;
@roppa
roppa / repo.sh
Created December 12, 2018 16:22
Bash Pull Repos
#!/bin/bash
# To run ./repo.sh username
repos=( repo1 repo2 repo3 )
for i in "${repos[@]}"
do
git clone git@github.com:$1/$i.git
done
@roppa
roppa / postgres-cheatsheet.md
Created August 8, 2018 10:20 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@roppa
roppa / letsencrypt_2017.md
Created April 3, 2018 16:18 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

There are two main modes to run the Let's Encrypt client (called Certbot):

  • Standalone: replaces the webserver to respond to ACME challenges
  • Webroot: needs your webserver to serve challenges from a known folder.

Webroot is better because it doesn't need to replace Nginx (to bind to port 80).

In the following, we're setting up mydomain.com. HTML is served from /var/www/mydomain, and challenges are served from /var/www/letsencrypt.

@roppa
roppa / watch node.js
Created March 1, 2018 16:08
Watch files and run tests on change
npm i -g watch
watch 'npm run test' src