Skip to content

Instantly share code, notes, and snippets.

View thedevsaddam's full-sized avatar
🏴‍☠️
Wherever we want to go, we'll go!

Saddam H thedevsaddam

🏴‍☠️
Wherever we want to go, we'll go!
View GitHub Profile
@thedevsaddam
thedevsaddam / main.go
Created September 16, 2022 09:21 — forked from alex-leonhardt/main.go
golang text/template with a map[string]interface{} populated from mixed json data
package main
import (
"encoding/json"
"os"
"reflect"
"text/template"
)
@thedevsaddam
thedevsaddam / scratch_server.go
Created September 13, 2022 07:16 — forked from jschaf/scratch_server.go
A Go web server from scratch using syscalls
package main
// Simple, single-threaded server using system calls instead of the net library.
//
// Omitted features from the go net package:
//
// - TLS
// - Most error checking
// - Only supports bodies that close, no persistent or chunked connections
// - Redirects
@thedevsaddam
thedevsaddam / postgres_queries_and_commands.sql
Created May 23, 2022 09:32 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@thedevsaddam
thedevsaddam / main.go
Created March 28, 2022 07:27 — forked from magiconair/main.go
prometheus counter example
package main
import (
"net/http"
"github.com/prometheus/client_golang/prometheus"
)
var (
cpuTemp = prometheus.NewGauge(prometheus.GaugeOpts{
@thedevsaddam
thedevsaddam / 0-go-os-arch.md
Created November 3, 2021 13:11 — forked from asukakenji/0-go-os-arch.md
Go (Golang) GOOS and GOARCH

Go (Golang) GOOS and GOARCH

All of the following information is based on go version go1.17.1 darwin/amd64.

GOOS Values

GOOS Out of the Box
aix
android
@thedevsaddam
thedevsaddam / Convert .mov or .MP4 to .gif.md
Last active October 29, 2021 17:31 — forked from SheldonWangRJT/Convert .mov or .MP4 to .gif.md
Convert Movie(.mov) file to Gif(.gif) file in one command line in Mac Terminal

This notes is written by Sheldon. You can find me with #iOSBySheldon in Github, Youtube, Facebook, etc.

Need

Convert .mov/.MP4 to .gif

Reason

As a developer, I feel better to upload a short video when I create the pull request to show other viewers what I did in this PR. I tried .mov format directly got after finishing recording screen using Quicktime, however, gif offers preview in most web pages, and has smaller file size.

This is not limited to developer, anyone has this need can use this method to convert the files.

@thedevsaddam
thedevsaddam / Makefile
Created August 30, 2021 07:11 — forked from mpneuried/Makefile
Simple Makefile to build, run, tag and publish a docker containier to AWS-ECR
# import config.
# You can change the default config with `make cnf="config_special.env" build`
cnf ?= config.env
include $(cnf)
export $(shell sed 's/=.*//' $(cnf))
# import deploy config
# You can change the default deploy config with `make cnf="deploy_special.env" release`
dpl ?= deploy.env
include $(dpl)
@thedevsaddam
thedevsaddam / Container.php
Created February 11, 2021 09:09 — forked from MustafaMagdi/Container.php
PHP Dependency Injection Container
<?php
/**
* Class Container
*/
class Container
{
/**
* @var array
*/
@thedevsaddam
thedevsaddam / System Design.md
Created January 25, 2021 09:05 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@thedevsaddam
thedevsaddam / log.go
Created January 22, 2021 19:43 — forked from gonzaloserrano/log.go
logrus wrapper
package log
import (
"fmt"
"github.com/Sirupsen/logrus"
"runtime"
"strings"
)
var logger = logrus.New()