Skip to content

Instantly share code, notes, and snippets.

View sw360cab's full-sized avatar

Sergio Maria Matone sw360cab

View GitHub Profile
wget -O - https://rpc.test4.gno.land/genesis | jq '.result.genesis' > genesis.json
@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)
@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
> 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 / 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
@sw360cab
sw360cab / Docker Nginx Oneline
Last active April 23, 2023 15:19
One line deploy of current directory into NGINX
docker run -d --name nginx -p 8080:80 -v $(pwd):/usr/share/nginx/html:ro nginx
@sw360cab
sw360cab / docker-ce-install-ubuntu.sh
Last active August 2, 2024 14:06
Docker CE installation
#!/bin/sh
# installing Docker CE on Ubuntu
# Run remotely with -> curl -sfL <http://_remote-address-of-this-script_> | sh -
## Compose not installed by default
set -e
# Run as su
if [ `id -u` -ne 0 ]
@sw360cab
sw360cab / docker-rm-exited.sh
Last active April 13, 2016 13:17
Remove container which status is 'Exited'
docker ps -a | grep 'Exited' | awk '{print $1}' | xargs docker rm -f
@sw360cab
sw360cab / mulo
Created March 19, 2012 15:42
mule file
<!-- TODO: remove autodelete / insert fileAge -->
<file:connector name="inputfileObjectConnector" autoDelete="false" pollingFrequency="2000000" recursive="true"> <!-- autoDelete="false" -->
<service-overrides messageFactory="org.mule.transport.file.FileMuleMessageFactory" />
</file:connector>
<flow name="edition">
<!-- #1 - Read video file input -->
<file:inbound-endpoint path="${fs.path.root}${fs.path.untranscoded}" connector-ref="inputfileObjectConnector" comparator="org.mule.transport.file.comparator.OlderFirstComparator" > <!-- 900s -> 15min -->
<!-- <file:filename-wildcard-filter pattern=".avi,.mp4"/> -> does not work -->
@sw360cab
sw360cab / kino
Created March 1, 2012 16:42
kino log
Mar 1 17:39:04 wimtv-dev kgd: last message repeated 3 times
Mar 1 17:39:04 wimtv-dev kgd: NFO - KGD: waiting connections
Mar 1 17:39:04 wimtv-dev kgd: DBG - CONN 87.241.57.98#346725017: listen loop start
Mar 1 17:39:04 wimtv-dev kgd: NFO - CONN 87.241.57.98#346725017 SOCKET: --- LISTEN ---
Mar 1 17:39:04 wimtv-dev kgd: DBG - ----- Reader::readSome --- PRIMA di recvFromSocket --- buffer size 1024 byte
Mar 1 17:39:04 wimtv-dev kgd: DBG - ----- Reader::recvFromSocket --- || NO FLAGS ||
Mar 1 17:39:04 wimtv-dev kgd: DBG - ----- Reader::readSome --- recvFromSocket 149 byte
Mar 1 17:39:04 wimtv-dev kgd: NFO - CONN 87.241.57.98#346725017 SOCKET: --- Listen: received 149 byte
Mar 1 17:39:04 wimtv-dev kgd: NFO - CONN 87.241.57.98#346725017 SOCKET: --- Listen: next msg length 149 byte
Mar 1 17:39:04 wimtv-dev kgd: DBG - CONN 87.241.57.98#346725017 SOCKET: --- Listen: MSG => DESCRIBE rtsp://test.wim.tv:8554/enc_GvzETxPCiDjE.mp4 RTSP/1.0#015#012CSeq: 2#015#012User-Agent: LIVE555 Streaming Media v2010.10.28#0