Skip to content

Instantly share code, notes, and snippets.

View rahulvramesh's full-sized avatar
💻
🚊

Rahul V Ramesh rahulvramesh

💻
🚊
View GitHub Profile
@rahulvramesh
rahulvramesh / swarm.yml
Created December 14, 2020 03:35 — forked from MetalArend/swarm.yml
Run a GitLab Runner on your Swarm
version: '3.4'
secrets:
# Find your registration token at: "Your project" > "Settings" > "CI/CD" > "Runners settings" > "Specific Runners" (look for registration token)
# Register it as `GITLAB_REGISTRATION_TOKEN`: `docker secret create GITLAB_REGISTRATION_TOKEN YOUR_REGISTRATION_TOKEN`
GITLAB_REGISTRATION_TOKEN:
external: true
# Find your personal access token at: "Your user account" > "Settings" > "Access Tokens" > "Create personal access token" (for api)
# Register it as `GITLAB_PERSONAL_ACCESS_TOKEN`: `docker secret create GITLAB_PERSONAL_ACCESS_TOKEN <YOUR ACCESS TOKEN>`
@rahulvramesh
rahulvramesh / install-docker.md
Created December 4, 2020 09:32 — forked from npearce/install-docker.md
Amazon Linux 2 - install docker & docker-compose using 'sudo amazon-linux-extras' command

UPDATE (March 2020, thanks @ic): I don't know the exact AMI version but yum install docker now works on the latest Amazon Linux 2. The instructions below may still be relevant depending on the vintage AMI you are using.

Amazon changed the install in Linux 2. One no-longer using 'yum' See: https://aws.amazon.com/amazon-linux-2/release-notes/

Docker CE Install

sudo amazon-linux-extras install docker
sudo service docker start
To manually dump the database you can run the following one-liner code
mysqldump -u[user] -p[pass] [db] > [file_path]
But what if you want to automate the process, here are the steps:
1. Setup cron entry to your server
* * * * * php /path-to-your-project/artisan schedule:run >> /dev/null 2>&1
2. Create a command BackupDatabase by running the following code:
@rahulvramesh
rahulvramesh / a-mongodb-replica-set-docker-compose-readme.md
Created November 16, 2020 07:15 — forked from harveyconnor/a-mongodb-replica-set-docker-compose-readme.md
MongoDB Replica Set / docker-compose / mongoose transaction with persistent volume

This will guide you through setting up a replica set in a docker environment using.

  • Docker Compose
  • MongoDB Replica Sets
  • Mongoose
  • Mongoose Transactions

Thanks to https://gist.github.com/asoorm for helping with their docker-compose file!

{
"search_for_markets_or_products": "Search for markets or products",
"top_markets": "Top Markets",
"ordered_by_nearby_first": "Ordered by Nearby first",
"trending_this_week": "Trending This Week",
"product_categories": "Product Categories",
"most_popular": "Most Popular",
"recent_reviews": "Recent Reviews",
"login": "Login",
"skip": "Skip",
@rahulvramesh
rahulvramesh / sshtunnel.go
Created October 15, 2020 03:09 — forked from iamralch/sshtunnel.go
SSH tunnelling in Golang
package main
import (
"log"
"bufio"
"time"
"os"
"fmt"
"io"
"net"

Keybase proof

I hereby claim:

  • I am rahulvramesh on github.
  • I am rahulvramesh (https://keybase.io/rahulvramesh) on keybase.
  • I have a public key whose fingerprint is 3814 E509 242F 527F A2A0 4172 E7A7 AFBB 9C91 D99D

To claim this, I am signing this object:

@rahulvramesh
rahulvramesh / next_nginx.md
Created September 19, 2020 13:58 — forked from kocisov/next_nginx.md
How to setup next.js app on nginx with letsencrypt

How to setup next.js app on nginx with letsencrypt

next.js, nginx, reverse-proxy, ssl

1. Install nginx and letsencrypt

$ sudo apt-get update
$ sudo apt-get install nginx letsencrypt

Also enable nginx in ufw

ol.lst-kix_list_7-0{list-style-type:none}.lst-kix_list_2-1>li{counter-increment:lst-ctn-kix_list_2-1}.lst-kix_list_21-8>li{counter-increment:lst-ctn-kix_list_21-8}ol.lst-kix_list_9-0.start{counter-reset:lst-ctn-kix_list_9-0 0}ol.lst-kix_list_13-4.start{counter-reset:lst-ctn-kix_list_13-4 0}.lst-kix_list_13-0>li{counter-increment:lst-ctn-kix_list_13-0}ol.lst-kix_list_20-2.start{counter-reset:lst-ctn-kix_list_20-2 0}ol.lst-kix_list_2-3.start{counter-reset:lst-ctn-kix_list_2-3 0}ol.lst-kix_list_7-5{list-style-type:none}ol.lst-kix_list_7-6{list-style-type:none}ol.lst-kix_list_7-7{list-style-type:none}ol.lst-kix_list_7-8{list-style-type:none}ol.lst-kix_list_7-1{list-style-type:none}ol.lst-kix_list_7-2{list-style-type:none}ol.lst-kix_list_7-3{list-style-type:none}ol.lst-kix_list_7-4{list-style-type:none}ol.lst-kix_list_23-2.start{counter-reset:lst-ctn-kix_list_23-2 0}.lst-kix_list_4-3>li{counter-increment:lst-ctn-kix_list_4-3}ol.lst-kix_list_17-1.start{counter-reset:lst-ctn-kix_list_17-1 0}.lst-kix_list_24-7>li{cou

from stackoverflow

The AccessManager will fire off two events that you can hook into. Firstly, when a token is near expiry, it will fire a token expired event. Hook into that event and when you receive it, generate a new token from your server. You can then set that new token in the AccessManager.