Skip to content

Instantly share code, notes, and snippets.

View syedrakib's full-sized avatar
:octocat:
Coding is easy. Engineering is tough.

Rakib Al Hasan syedrakib

:octocat:
Coding is easy. Engineering is tough.
  • Greater Vancouver Area, BC, Canada
View GitHub Profile
@syedrakib
syedrakib / declarative.yaml
Last active December 23, 2022 09:19
Hello Kong. Embedded in my medium article about "Spinning up an API Gateway with DBLess Kong Gateway". Draft link here https://medium.com/airasia-com-tech-blog/spinning-up-an-api-gateway-with-dbless-kong-gateway-2100be03619b
_format_version: "2.1"
_transform: true
services:
- name: mock # any meaningful name to identify our API
url: https://mockbin.org/bin/dd5b993d-c69b-48db-9036-829fb7955f58 # a remote backend that we will proxy to - clients will not know about this
routes:
- paths:
- /mock # an API path that we will call
methods:
package main
import (
"fmt"
"math/rand"
"sync"
"time"
)
var program_start_time time.Time
package main
import (
"fmt"
"math/rand"
"time"
)
var program_start_time time.Time
var program_end_time time.Time
package main
import (
"fmt"
"math/rand"
"time"
)
var program_start_time time.Time
var program_end_time time.Time
@syedrakib
syedrakib / providers.tf
Last active April 16, 2020 17:53
Terraform on GCP - impersonating with short-lived AccessTokens & ServiceAccounts
provider "google" {
credentials = file(var.path_to_tf_executor_service_account_json_file)
alias = "tf_executor"
}
data "google_service_account_access_token" "impersonated" {
provider = google.tf_executor
target_service_account = var.tf_owner_service_account_email
scopes = [ "cloud-platform" ]
lifetime = "1800s" # 30 minutes - max can be set up to 60 minutes
@syedrakib
syedrakib / RSA_example.py
Last active June 21, 2024 19:48
An example of asymmetric encryption in python using a public/private keypair - utilizes RSA from PyCrypto library
# Inspired from http://coding4streetcred.com/blog/post/Asymmetric-Encryption-Revisited-(in-PyCrypto)
# PyCrypto docs available at https://www.dlitz.net/software/pycrypto/api/2.6/
from Crypto import Random
from Crypto.PublicKey import RSA
import base64
def generate_keys():
# RSA modulus length must be a multiple of 256 and >= 1024
modulus_length = 256*4 # use larger value in production
@syedrakib
syedrakib / AES_example.py
Last active September 27, 2023 13:58
an example of symmetric encryption in python using a single known secret key - utilizes AES from PyCrypto library
# Inspired from https://pythonprogramming.net/encryption-and-decryption-in-python-code-example-with-explanation/
# PyCrypto docs available at https://www.dlitz.net/software/pycrypto/api/2.6/
from Crypto.Cipher import AES
import base64, os
def generate_secret_key_for_AES_cipher():
# AES key length must be either 16, 24, or 32 bytes long
AES_key_length = 16 # use larger value in production
# generate a random secret key with the decided key length
<html>
<head>
<!--Load the AJAX API-->
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
// Load the Visualization API and the piechart package.
google.load('visualization', '1.0', {packages:["corechart","geochart","table"]});
// Set a callback to run when the Google Visualization API is loaded.