Skip to content

Instantly share code, notes, and snippets.

View asoorm's full-sized avatar

Ahmet Soormally asoorm

View GitHub Profile
@asoorm
asoorm / hmac-postman-pre-request-script.js
Last active February 14, 2024 17:10
Postman pre-request script to sign http requests with a HMAC shared secret
/* CHANGE THIS STUFF */
const KEY_ID = "61eaf3e25ebd3aa2f8d2958953bc5cc49e754195ac07e70c4f6d8fb6";
const HMAC_SECRET = "NWU0MzQ0ZjZmY2JiNGU4N2I1NmEyZjJlYTRlOTE0YzI=";
const SIGN_REQUEST_TARGET = true;
const SIGN_REQUEST_DATE = true;
const HEADERS_TO_SIGN = ["x-test-1", "x-test-2"];
const SIGNING_ALGORITHM = "hmac-sha512"; // supported algorithms: hmac-sha1, hmac-sha256, hmac-sha384, hmac-sha512
/* DO NOT CHANGE BELOW THIS LINE */
@asoorm
asoorm / udg-kafka.yaml
Created March 22, 2023 16:04
Publish a Kafka topic as a GraphQL Subscription declaratively with Tyk's Univeral Data Graph
apiVersion: tyk.tyk.io/v1alpha1
kind: ApiDefinition
metadata:
name: udg-kafka
spec:
name: Universal Data Graph Kafka # name of the API Definition
use_keyless: true # make the api keyless (no security)
active: true # API can be active or inactive
graphql:
enabled: true # enable GraphQL Mode
module.exports = posts =
[
{
"userId": 1,
"id": 1,
"title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
"body": "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"
},
{
"userId": 1,
module.exports = users =
[
{
"id": 1,
"name": "Leanne Graham",
"username": "Bret",
"email": "Sincere@april.biz",
"address": {
"street": "Kulas Light",
"suite": "Apt. 556",
{
"name": "httpbin",
"use_keyless": true,
"version_data": {
"not_versioned": true,
"versions": {
"Default": {
"name": "Default",
"use_extended_paths": true
}
{
"api_definition": {
"jwt_issued_at_validation_skew": 0,
"upstream_certificates": {},
"use_keyless": true,
"enable_coprocess_auth": false,
"base_identity_provided_by": "",
"custom_middleware": {
"pre": [],
"post": [],

Keybase proof

I hereby claim:

  • I am asoorm on github.
  • I am asoorm (https://keybase.io/asoorm) on keybase.
  • I have a public key ASBhBNyXlsO6o8K7TTNTF7JPmAOgoeaulgQuRyBTTCUq1Ao

To claim this, I am signing this object:

@asoorm
asoorm / bench_script.sh
Created January 26, 2019 09:37
tyk gateway simple bench script
sudo systemctl enable docker
docker network create tyk
docker run -itd --name redis --restart on-failure --network tyk redis:5.0-alpine
# this is the upstream server that tyk will reverse proxy to
docker run -itd --name nginx --restart on-failure --network tyk nginx:1.15.8-alpine
mkdir apidefs
@asoorm
asoorm / docker-compose-mongo-replicaset.yml
Created September 14, 2018 19:00
Mongo Replica Set docker compose
version: "3"
services:
mongo1:
hostname: mongo1
container_name: localmongo1
image: mongo:4.0-xenial
expose:
- 27017
ports:
- 27011:27017
@asoorm
asoorm / api_definition_preTransformContentType.json
Last active April 25, 2023 17:21
Tyk Gateway JSVM middleware to inspect the Content-Type Header, and if matches, transform it to something else.
{
"id": "5b6973533f03d3608d46cf8c",
"name": "httpbin",
"slug": "httpbin",
"api_id": "e69126ef8100421c4c81b9982b51eb80",
"org_id": "5b296ceb3f03d310fffc9b9d",
"use_keyless": true,
"use_oauth2": false,
"use_openid": false,
"openid_options": {