Skip to content

Instantly share code, notes, and snippets.

View ratulbasak's full-sized avatar
:octocat:
live in console

Ratul Basak ratulbasak

:octocat:
live in console
View GitHub Profile
@jsdevtom
jsdevtom / frontend-ws-connection.ts
Last active July 26, 2024 16:21
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)
)
)
);
@xynova
xynova / aws-registry-credential-cron.yml
Last active November 17, 2021 17:57
Kubernetes CronJob to keep AWS Registry pull credentials fresh
apiVersion: batch/v2alpha1
kind: CronJob
metadata:
name: aws-registry-credential-cron
spec:
schedule: "* */8 * * *"
successfulJobsHistoryLimit: 2
failedJobsHistoryLimit: 2
jobTemplate:
spec:
TargetGroup:
Type: AWS::ElasticLoadBalancingV2::TargetGroup
Properties:
VpcId: !Ref VPC
Port: 80
Protocol: HTTP
Matcher:
HttpCode: 200-299
HealthCheckIntervalSeconds: 80
HealthCheckPath: !Ref HealthCheckPath
@soheilhy
soheilhy / nginxproxy.md
Last active May 16, 2024 08:59
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@qguv
qguv / functional_python.py
Created February 26, 2014 15:06
Simple examples of reduce, map, filter, lambda, and unpacking in Python 2
#!/usr/bin/env python2
# Functional Python: reduce, map, filter, lambda, *unpacking
# REDUCE EXAMPLE
add = lambda *nums: reduce(lambda x, y: x + y, nums)
def also_add(*nums):
'''Does the same thing as the lambda expression above.'''
def add_two_numbers(x, y):