Skip to content

Instantly share code, notes, and snippets.

View sw360cab's full-sized avatar

Sergio Maria Matone sw360cab

View GitHub Profile
@sw360cab
sw360cab / docker-ce-install-aws-ami.sh
Last active June 5, 2020 18:05
Simply add Docker in a AWS AMI Linux
#!/bin/sh
# installing Docker CE on AWS AMI Linux
# Run remotely with -> source <(curl -s http://<remote-address-of-this-script>.sh)
set -e
# Run as su
if [ `id -u` -ne 0 ]
then
> obj = { rows : [{count: 10}, {count:20}] }
{ rows: [ { count: 10 }, { count: 20 } ] }
> {rows: [{count: val}]} = obj
{ rows: [ { count: 10 }, { count: 20 } ] }
> val
10
> {rows: [{count}]} = obj
{ rows: [ { count: 10 }, { count: 20 } ] }
> count
10
@sw360cab
sw360cab / cluster_k8s.sh
Created September 29, 2021 14:42
Bash Script that enables a K8S cluster by installing Rancher K3S and Helm
#!/bin/sh
# Run remotely with -> source <(curl -s http://<remote-address-of-this-script>.sh)
set -e
# Run as su
if [ `id -u` -ne 0 ]
then
echo "You need to be root to run this script"
exit 1
@sw360cab
sw360cab / reflect-compare.go
Created March 17, 2022 11:21
using reflection to create a generic lookup method in Go
package main
import (
"fmt"
"reflect"
)
// Check if item is i an array for any type using reflection
func containsAny(items interface{}, value interface{}) bool {
itemsValue := reflect.ValueOf(items)
wget -O - https://rpc.test4.gno.land/genesis | jq '.result.genesis' > genesis.json
@sw360cab
sw360cab / docker-gnorpc.sh
Created March 31, 2025 15:51
Run in docker a Gnoland RPC node
docker run --rm --entrypoint sh -p 26657:26657 ghcr.io/gnolang/gno/gnoland:master -c 'gnoland config init; gnoland config set rpc.laddr "tcp://0.0.0.0:26657"; gnoland start --lazy'