Skip to content

Instantly share code, notes, and snippets.

View rrmerugu's full-sized avatar
🎯
Focusing

Ravi Raja Merugu rrmerugu

🎯
Focusing
View GitHub Profile
@rrmerugu
rrmerugu / state.js
Created March 5, 2024 08:03 — forked from dbisso/state.js
Simple state management in vanilla JS
function State() {
this.actions = {};
this.subscriptions = [];
this.history = [];
}
State.prototype.subscribe = function(element, action, callback) {
this.subscriptions[action] = this.subscriptions[action] || [];
this.subscriptions[action].push(function(data) {
callback.apply(element, data);
@rrmerugu
rrmerugu / k3s-cluster.md
Created January 3, 2023 19:17 — forked from kopwei/k3s-cluster.md
K3s and Rancher on Raspberry Pi 4 Cluster

Deploy K3s and Rancher on Raspberry Pi 4 cluster

Today I tried to setup a small Kubernetes cluster on top of 3 Raspberry Pi 4 (4GB Memory). Here is the steps to install the cluster.

IMG_3817

Preparation

I have 3 Raspberry Pi 4 stacked with PoE headers and connected to a PoE switch at home. The are connected to Internet through a home router. All Pis are equipped with a 64GB Samsung SDXC card flushed with Ubuntu 20.04 image.

# start GremlinServer
# bin/gremlin-server.sh -i org.apache.tinkerpop gremlin-python 3.2.2-SNAPSHOT
# bin/gremlin-server.sh conf/gremlin-server-modern-py.yaml
from gremlin_python.process.graph_traversal import GraphTraversal
from gremlin_python.process.graph_traversal import GraphTraversalSource
from gremlin_python.process.graph_traversal import __
from gremlin_python.process.traversal import Operator
from gremlin_python.structure.io.graphson import GraphSONReader
@rrmerugu
rrmerugu / eventsim.py
Created March 10, 2020 16:36 — forked from damonjw/LICENSE
Event driven simulator in Python, using async/await
import heapq
import asyncio
class EventSimulator(asyncio.AbstractEventLoop):
'''A simple event-driven simulator, using async/await'''
def __init__(self):
self._time = 0
self._running = False
self._immediate = []
@rrmerugu
rrmerugu / README.md
Created February 28, 2020 03:53 — forked from roachhd/README.md
Feed.xml RSS for Jekyll blog on GitHub pages.

Jekyll RSS Feed Templates.

A few Liquid templates to use for rendering RSS feeds for your Jekyll blog. Featuring four kinds of feeds:

  • feed.xml — Renders the 10 most recent posts.
  • feed.category.xml — Only renders posts for a specific category. This example renders posts for a "miscellaneous" category.
  • feed.links.xml — Only contains posts that link to external websites noted by a link variable in the YAML Front Matter. Not a common Jekyll convention, but a good way to generating a linked list.
  • feed.articles.xml — Only showing articles that don't link to external sites; The opposite of feed.links.xml.
@rrmerugu
rrmerugu / RunAProxyOnAmazonEC2VPC.md
Created March 7, 2019 16:52 — forked from webinista/RunAProxyOnAmazonEC2VPC.md
Create a proxy server on an Amazon EC2 (VPC) instance

This will create a proxy server in whatever your availability zone your VPC is in. For me, that's us-east-1b. For you, that may be something different. Steps 10+ should more or less work regardless of your provider since those steps cover the setup and configuration of TinyProxy.

  1. Click the Launch Instance button.
  2. Choose Ubuntu Server 14.04 LTS (HVM), SSD Volume Type. This isn't strictly necessary. If you choose another OS, check its documentation for how to install new packages.
  3. On the Choose an Instance Type screen, select t2.micro. It's Free Tier eligible.
  4. Click the Next: ... buttons until you reach the Configure Security Group screen.
    • You may wish to reduce the amount of storage on the Add Storage screen. This is optional.
    • You may wish to add a tag on the Tag Instance screen. This is also optional.
  5. On the Configure Security Group screen:
  • Select Create a new security group.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# from fabric.api import *
# from fabric.colors import green as _green, yellow as _yellow
from boto.ec2.connection import EC2Connection
import time
# def start_machine(ami='ami-d7a18dbe'):
'''Launch a single instance of the provided ami'''
aws_access_key_id = 'Cf7...'
@rrmerugu
rrmerugu / connect-remote-mongo-via-ssh-tunnel.md
Created July 26, 2017 16:32 — forked from umidjons/connect-remote-mongo-via-ssh-tunnel.md
Create ssh tunnel and connect to the remote mongo database on command line

Create ssh tunnel and connect to the remote mongo database on command line

Assume followings:

/mykeys/.ssh/prodserver.pem - is a certificate file

umid - is a user name

111.111.111.111 - is a remote host, that mongodb runs

@rrmerugu
rrmerugu / deploy_dockerhub.sh
Created June 30, 2017 21:33 — forked from robvanderleek/deploy_dockerhub.sh
Buzz generator deploy to DockerHub script
#!/bin/sh
docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
if [ "$TRAVIS_BRANCH" = "master" ]; then
TAG="latest"
else
TAG="$TRAVIS_BRANCH"
fi
docker build -f Dockerfile -t $TRAVIS_REPO_SLUG:$TAG .
docker push $TRAVIS_REPO_SLUG