Skip to content

Instantly share code, notes, and snippets.

View mortymacs's full-sized avatar

Morteza (Mort) NourelahiAlamdari mortymacs

View GitHub Profile
@mortymacs
mortymacs / jsonapi_oas.yml
Created November 15, 2022 09:10 — forked from naesean/jsonapi_oas.yml
OpenAPI 3.0 schemas that comply with the JSON:API 1.0 specification
JSONAPIObject:
description: Includes the current JSON:API version for this specification as well as optional meta information
type: object
required:
- version
properties:
version:
type: string
default: '1.0'
example: '1.0'
@mortymacs
mortymacs / tls-client.go
Created November 15, 2022 07:59 — forked from michaljemala/tls-client.go
SSL Client Authentication Golang sample
package main
import (
"crypto/tls"
"crypto/x509"
"flag"
"io/ioutil"
"log"
"net/http"
)
@mortymacs
mortymacs / sample-any.go
Last active November 9, 2022 12:40
GORM model with different attributes
package main
import (
"gorm.io/gorm"
"log"
)
import "gorm.io/driver/postgres"
type StaffAttribute struct {
Department string `gorm:"type:string"`
@mortymacs
mortymacs / code.sh
Created November 8, 2022 09:09
Restore an old deleted directory in Git
$ git rev-list -n 1 HEAD -- /path/to/dir
a92a0d4bd882a352cd3866882b44bb5efa58116f
$ git checkout a92a0d4bd882a352cd3866882b44bb5efa58116f^ -- /path/to/dir
# https://stackoverflow.com/questions/30875205/restore-a-deleted-folder-in-a-git-repo
@mortymacs
mortymacs / aws-vpc.tf
Created October 29, 2022 10:20 — forked from gkze/aws-vpc.tf
variable "aws_access_key" {}
variable "aws_secret_key" {}
provider "aws" {
access_key = "${var.aws_access_key}"
secret_key = "${var.aws_secret_key}"
region = "us-east-1"
}
resource "aws_vpc" "terraform-testing" {
@mortymacs
mortymacs / PKGBUILD
Created October 19, 2022 12:34
tabbed AUR package
# Maintainer: Morteza NourelahiAlamdari <[email protected]>
# This project is the copy of tabbed-git AUR package but with some changes.
pkgname=tabbed
pkgver=0.7
pkgrel=1
pkgdesc="Simple generic tabbed fronted to xembed aware applications"
arch=('x86_64')
url="https://tools.suckless.org/tabbed/"
license=('MIT/X')
depends=('libxft')
@mortymacs
mortymacs / main.go
Created October 19, 2022 12:33
Context WithValue + chaning value
package main
import (
"context"
"fmt"
)
func main() {
c := context.WithValue(context.Background(), "foo", map[string]string{"name": "mort"})
var foo map[string]string
@mortymacs
mortymacs / main.go
Created October 19, 2022 12:31
Composition sample in Go
package main
import (
"fmt"
)
type User struct {
Name string
Age int
}
@mortymacs
mortymacs / Makefile
Last active October 19, 2022 12:29
include makefile remotely
$(shell [ ! -e /tmp/go-makefile ] && curl https://raw.githubusercontent.com/atkrad/wait4x/main/Makefile > /tmp/go-makefile)
include /tmp/go-makefile
@mortymacs
mortymacs / zsh-autocomplete
Created October 15, 2022 21:34
zsh-autocomplete AUR package
# Maintainer: Morteza NourelahiAlamdari <[email protected]>
# This is copy of zsh-autocomplete-git with a little changes
# to download the latest released version instead of git.
pkgname=zsh-autocomplete
pkgver=22.01.21
pkgrel=1
pkgdesc='Real-time type-ahead completion for Zsh. Asynchronous find-as-you-type autocompletion.'
arch=('any')
url='https://github.com/marlonrichert/zsh-autocomplete'