Skip to content

Instantly share code, notes, and snippets.

View prayagsingh's full-sized avatar
:octocat:
Working from home

Prayag Singh prayagsingh

:octocat:
Working from home
View GitHub Profile
@prayagsingh
prayagsingh / parseTransaction.go
Created January 16, 2023 18:02 — forked from crazygit/parseTransaction.go
Parse Ethereum Transaction, Decode input data, Decode output data
package main
import (
"context"
"encoding/hex"
"fmt"
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethclient"
@prayagsingh
prayagsingh / ChainlinkClient.sol
Created August 7, 2021 07:36
Polygon-Chainlink ConsumerAPI integration using solidity v0.8.0;
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./Chainlink.sol";
import "./interfaces/ENSInterface.sol";
import "./interfaces/LinkTokenInterface.sol";
import "./interfaces/OperatorInterface.sol";
import "./interfaces/PointerInterface.sol";
import { ENSResolver as ENSResolver_Chainlink } from "./vendor/ENSResolver.sol";
admins = {
"{{ .Env.JICOFO_AUTH_USER }}@{{ .Env.XMPP_AUTH_DOMAIN }}",
"{{ .Env.JVB_AUTH_USER }}@{{ .Env.XMPP_AUTH_DOMAIN }}"
}
plugin_paths = { "/prosody-plugins/", "/prosody-plugins-custom" }
http_default_host = "{{ .Env.XMPP_DOMAIN }}"
muc_mapper_domain_prefix = "muc"
muc_mapper_domain_base = "{{ .Env.XMPP_DOMAIN }}"
@prayagsingh
prayagsingh / frontend-ws-connection.ts
Created March 9, 2021 19:32 — forked from jsdevtom/frontend-ws-connection.ts
kubernetes-ingress websockets with nodejs
export const ws = webSocket<WebsocketMessage>(`wss://${location.hostname}:${location.protocol === 'https:' ? 443 : 80}/ws/`);
export const wsObserver = ws
.pipe(
retryWhen(errors =>
errors.pipe(
delay(1000)
)
)
);
Ingress - https://kubernetes.io/docs/concepts/services-networking/ingress/
Ingress controller - https://kubernetes.io/docs/concepts/services-networking/ingress-controllers/
DEMO 1
=======================
Centos 7 system
yum install docker -y
systemctl start docker
systemctl enable docker
#install docker-compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.26.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
@prayagsingh
prayagsingh / traefik.yml
Created April 27, 2020 11:07 — forked from jakubhajek/traefik.yml
The example of Traefik 2.x configuration that is set on startup.
log:
level: info
format: json
accessLog:
format: json
bufferingSize: 5
providers:
docker:
@prayagsingh
prayagsingh / stack-canary.yml
Created April 27, 2020 11:07 — forked from jakubhajek/stack-canary.yml
The example of canary deployment using Traefik 2.x
# docker stack deploy -c stack-canary.yml canary --with-registry-auth --prune
version: "3.7"
services:
app1:
image: jakubhajek/app1-node:v1
healthcheck:
test: wget --quiet --tries=1 --spider http://localhost:3000/ || exit 1
interval: 3s
timeout: 1s
# docker stack deploy -c stack-app.yml app --with-registry-auth --prune
version: "3.7"
services:
backend:
image: jakubhajek/nodejs-backend:latest
healthcheck:
test: wget --quiet --tries=1 --spider http://localhost:3000/ || exit 1
interval: 3s
timeout: 1s
# docker stack deploy -c stack-tr-main.yml traefik --prune
version: "3.7"
services:
main:
image: traefik:v2.1.2
healthcheck:
test: wget --quiet --tries=1 --spider https://traefik.labs.cometari.eu/ping || exit 1
interval: 3s
timeout: 1s
@prayagsingh
prayagsingh / middlewares.toml
Created April 27, 2020 11:05 — forked from jakubhajek/middlewares.toml
The configuration of Traefik v2 that can be defined dynamically
[http]
[http.middlewares]
[http.middlewares.https-redirect.redirectscheme]
scheme = "https"
permanent = true
[http.middlewares.security-headers.headers]
# CORS
AccessControlAllowMethods = ["GET", "OPTIONS", "PUT"]
AccessControlAllowOrigin = "origin-list-or-null"