Skip to content

Instantly share code, notes, and snippets.

View r6m's full-sized avatar
🏠
Working from home

Reza r6m

🏠
Working from home
  • localhost
View GitHub Profile
@r6m
r6m / README.md
Created November 18, 2021 07:37
hashicorp vault LDAP auth

LDAP

let's assume you already have the ldap server already running.

enable ldap method in vault:

$ vault auth enable ldap
@r6m
r6m / vault_oidc.md
Last active November 18, 2021 12:59
hashicorp vault OIDC authentication

installation

after installing vault run the following command to login:

the root token is printed to stdout on the first run.

$ vault login -method=token [your root token]
@r6m
r6m / main.go
Created September 16, 2021 09:25 — forked from walm/main.go
Simple Golang DNS Server
package main
import (
"fmt"
"log"
"strconv"
"github.com/miekg/dns"
)
@r6m
r6m / frontmatter.js
Created June 27, 2021 04:13 — forked from sudkumar/frontmatter.js
MDX Remark plugin to handle frontmatter
// helps us in parsing the frontmatter from text content
const matter = require('gray-matter')
// helps us safely stringigy the frontmatter as a json object
const stringifyObject = require('stringify-object')
// helps us in getting the reading time for a given text
const readingTime = require('reading-time')
// please make sure you have installed these dependencies
// before proceeding further, or remove the require statements
// that you don't use
@r6m
r6m / restricted_usernames.py
Created January 19, 2021 14:47 — forked from theskumar/restricted_usernames.py
Restricted usernames
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
'''
List of reserved usernames (pre-defined list of special banned and reserved keywords in names,
such as "root", "www", "admin"). Useful when creating public systems, where users can choose
a login name or a sub-domain name.
__References:__
1. http://www.bannedwordlist.com/
2. http://blog.postbit.com/reserved-username-list.html
@r6m
r6m / nginx-minio-static.md
Created December 31, 2020 05:49 — forked from harshavardhana/nginx-minio-static.md
How to configure static website using Nginx with MinIO ?

How to configure static website using Nginx with MinIO ?

1. Install nginx

2. Install minio

3. Install mc client

4. Create a bucket:

$ mc mb myminio/static
Bucket created successfully ‘myminio/static’.
@r6m
r6m / kvm_minikube.md
Created November 18, 2020 07:58 — forked from alexellis/kvm_minikube.md
Run multiple minikube Kubernetes clusters on Ubuntu Linux with KVM

Ramp up your Kubernetes development, CI-tooling or testing workflow by running multiple Kubernetes clusters on Ubuntu Linux with KVM and minikube.

In this tutorial we will combine the popular minikube tool with Linux's Kernel-based Virtual Machine (KVM) support. It is a great way to re-purpose an old machine that you found on eBay or have gathering gust under your desk. An Intel NUC would also make a great host for this tutorial if you want to buy some new hardware. Another popular angle is to use a bare metal host in the cloud and I've provided some details on that below.

We'll set up all the tooling so that you can build one or many single-node Kubernetes clusters and then deploy applications to them such as OpenFaaS using familiar tooling like helm. I'll then show you how to access the Kubernetes clusters from a remote machine such as your laptop.

Pre-reqs

  • This tutorial uses Ubuntu 16.04 as a base installation, but other distributions are supported by KVM. You'll need to find out how to install
@r6m
r6m / gamedev-trigonometry.md
Created June 19, 2020 08:58 — forked from jhonnymichel/gamedev-trigonometry.md
Basic trigonometry for game development

Introduction

two distinct points (for example, a game object position and the mouse cursor position) in an area can always be two corners of a Right Triangle (Triângulo-retângulo in ptbr). A triangle has three sides: The Hypotenuse, the Adjacent and the Opposite.

The distance between two points in the X axis corresponds to the Adjacent side of a triangle, The distance between two points in the Y axis corresponds to the Opposite side of a triangle.

The Hypotenuse is the shortest distance between the two points.

This means we can use trigonometry to handle many interactions between objects when programming visual stuff.

@r6m
r6m / git-auto-sign-commits.sh
Created May 24, 2020 02:19 — forked from mort3za/git-auto-sign-commits.sh
Auto sign your git commits
# Generate a new pgp key: (better to use gpg2 instead of gpg in all below commands)
gpg --gen-key
# maybe you need some random work in your OS to generate a key. so run this command: `find ./* /home/username -type d | xargs grep some_random_string > /dev/null`
# check current keys:
gpg --list-secret-keys --keyid-format LONG
# See your gpg public key:
gpg --armor --export YOUR_KEY_ID
# YOUR_KEY_ID is the hash in front of `sec` in previous command. (for example sec 4096R/234FAA343232333 => key id is: 234FAA343232333)
@r6m
r6m / bits.go
Created December 27, 2019 04:33
golagn bit mask big int
package bits
import "math/big"
// Flag is an alias of big.Int
type Flag struct {
Bits *big.Int
}
// NewFlag returns a Flag with 0 bits