Skip to content

Instantly share code, notes, and snippets.

View meysampg's full-sized avatar
🖖
bit bit 0 bit

Meysam P. Ganji meysampg

🖖
bit bit 0 bit
View GitHub Profile
@meysampg
meysampg / dataquest_de_path_outlines.md
Created May 21, 2021 17:08
DataQuest Path for Data Engineering
https://extensions.gnome.org/extension/779/clipboard-indicator/
https://extensions.gnome.org/extension/307/dash-to-dock/
https://extensions.gnome.org/extension/1065/docker-status/
https://extensions.gnome.org/extension/1319/gsconnect/
https://extensions.gnome.org/extension/28/gtile/
https://extensions.gnome.org/extension/545/hide-top-bar/
https://extensions.gnome.org/extension/104/netspeed/
https://extensions.gnome.org/extension/750/openweather/
https://extensions.gnome.org/extension/240/persian-calendar/
https://extensions.gnome.org/extension/19/user-themes/
@meysampg
meysampg / nationalid.go
Created January 13, 2021 09:36
Iran NationalID Validator
package main
import (
"fmt"
"strconv"
"strings"
)
type NIDError string
@meysampg
meysampg / info.go
Created December 9, 2020 14:28
Build Binary Injection in Go
package info
import (
"fmt"
"time"
)
var (
AppVersion string
BuildTime string
@meysampg
meysampg / scan_db_unknown_fields.go
Last active September 2, 2020 12:08
Save results of rows.Scan of an unknown select set
result := make([]map[string]interface{}, 0)
columns, err := rows.Columns()
if err != nil {
return nil, err
}
numCol := len(columns)
values := make([]interface{}, numCol)
valuePtrs := make([]interface{}, numCol)
for rows.Next() {
# follow http://fzero.rubi.gd/post/general/gpg-step-by-step/ for creating a gpg key
# set the gpgp-sign commit flag to true (globally)
git config --global commit.gpgsign true
# find the key ID ([S])
gpg --list-secret-keys --keyid-format LONG <EMAIL>
# introduce your key ID to git (globally)
git config --global user.signingkey <KEY_ID>
@meysampg
meysampg / assert_time_equality.go
Created July 27, 2020 14:12
More readable to compare times
import (
"time"
"github.com/stretchr/testify/assert"
)
func compareTimes(t assert.TestingT, expected, actual [2]time.Time) {
assertTruefTime(t, "start", expected[0], actual[0])
assertTruefTime(t, "end", expected[1], actual[1])
}
import scala.annotation.tailrec
val a = List(1, 2, 3, 4)
@tailrec
def powerset(current: List[List[Int]], given: List[Int]): List[List[Int]] = given match {
case Nil => current
case head :: tail => powerset(current ++ (current map {x => head::x}), tail)
}
export $(echo "BFN_query_timeout_seconds" | tr -t "[:lower:]" "[:upper:]")=5
@meysampg
meysampg / mem_leak.py
Created June 18, 2020 10:54
Showing memory usage info as debug on logging
import logging
from pympler import muppy, summary
def mem_leak():
all_objects = muppy.get_objects()
sum1 = summary.summarize(all_objects)
logging.debug("\n" + "\n".join(list(summary.format_(sum1))))