Skip to content

Instantly share code, notes, and snippets.

@mhewedy
mhewedy / README.md
Last active September 30, 2020 15:19
Make release

Usage:

$ mkrel path/to/release
2.02.159

To see the whole list in debug mode, define a DEBUG env var and set it to 1:

package main
import (
"context"
"database/sql"
"fmt"
"github.com/Fs02/rel"
"github.com/Fs02/rel/adapter/postgres"
"github.com/jackc/pgx/v4"
pgxs "github.com/jackc/pgx/v4/stdlib"
@mhewedy
mhewedy / curl
Created August 24, 2020 20:39
my curl
/usr/bin/curl -s -H "content-type: application/json" $(echo " "$@ | perl -pe 's/\s+(:[0-9]+)/localhost$1/g') | jq
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"strings"
"time"
)
@mhewedy
mhewedy / iptv.go
Created May 30, 2020 04:36
group ip tv
package main
import (
"fmt"
"io/ioutil"
"os"
"regexp"
"sort"
"strings"
)
# worker.sh
# find most updated version at: https://github.com/mhewedy/vermin/tree/master/etc/samples-provision/k8s
# HW requirements: 1 CPUS 2 RAM
# OS: Ubuntu focal
set -ex
#should be $(lsb_release -cs) but it appears it is not working on focal yet
docker_ubuntu_release=bionic
k8s_version=1.18.0
# master.sh
# find most updated version at: https://github.com/mhewedy/vermin/tree/master/etc/samples-provision/k8s
# HW requirements: 2 CPUS 2 RAM
# OS: Ubuntu focal
set -ex
#should be $(lsb_release -cs) but it appears it is not working on focal yet
docker_ubuntu_release=bionic
k8s_version=1.18.0
@mhewedy
mhewedy / defer.go
Created May 7, 2020 11:30
Defer trick to around wrap function code
package main
import (
"fmt"
)
type Tnx struct {
}
func main() {
print_vms() {
arr=$1
printf "VM NAME\t\tIMAGE\t\t\tCPU\t\tMEM\t\tTAGS\n"
if [ ${arr} ]; then
for element in "${arr[@]}"; do
spec=($(VBoxManage showvminfo ${element} --machinereadable | grep -E "memory=|cpus=" | cut -d "=" -f2))
printf "%s\t\t$(cat ~/.vms/${element}/image 2>/dev/null || cat <(echo "\t") )\t\t%s\t\t%s MB\t\t%s\n" ${element} ${spec[1]} ${spec[0]} \
"$(echo $(cat ~/.vms/${element}/tags 2>/dev/null))"
done
fi
@mhewedy
mhewedy / Data_Engineering.md
Created March 28, 2020 12:09
Data Engineering

Data Engineering

Staging Data

  • Loading & Profiling data
  • Data Quality Testing
    • check for nulls for key fields (ids, amount, etc..)
    • check for Invalid date-time, lookups

Cleansing Data:

  • Adding data types:
  • Adding numeric & date-time data types instead of just strings