Skip to content

Instantly share code, notes, and snippets.

Avatar
🔥
Game is on

Prasanna worldofprasanna

🔥
Game is on
View GitHub Profile
View create-postgres-db.sh
# Install postgres plugin
dokku plugin:install https://github.com/dokku/dokku-postgres.git postgres
# Create postgres database
dokku postgres:create my-database
# Link the postgres with the app
dokku postgres:link <DB_NAME> <APP_NAME>
# eg: dokku postgres:link my-database getting-started-with-dokku
@worldofprasanna
worldofprasanna / add-team-mates-to-dokku.sh
Created Jun 7, 2020
Adding team mates to dokku application
View add-team-mates-to-dokku.sh
# SSH into the virtual machine
ssh root@<vm-public-ip-address>
# Add their public keys to the authorized keys
vi ~/.ssh/authorised_keys
# Add their public keys to the dokku application
dokku ssh-keys:add <user> <path-to-public-key>
# eg: dokku ssh-keys:add prasanna /root/pub-keys/prasanna.pub
# List the users who have permission
dokku ssh-keys:list
View deploy_dokku_app.sh
# Push the changes to remote(dokku) origin
git push dokku master
# List the apps in dokku
dokku apps:list
@worldofprasanna
worldofprasanna / setup_remote_origin_dokku.sh
Last active Jun 7, 2020
Create new application in dokku
View setup_remote_origin_dokku.sh
# Clone the repo
git clone git@github.com:worldofprasanna/getting-started-with-dokku.git
# cd into the repo
cd getting-started-with-dokku
# Install dokku client locally
brew install dokku/repo/dokku
# Create dokku app
dokku apps:create getting-started-with-dokku
# Add a git remote to point to dokku app
git remote add dokku dokku@<vm-public-ip-address>:getting-started-with-dokku
@worldofprasanna
worldofprasanna / install_dokku.sh
Last active Jun 7, 2020
Installation of dokku
View install_dokku.sh
ssh root@<vm-public-ip-address>
# Inside VM
wget https://raw.githubusercontent.com/dokku/dokku/v0.20.4/bootstrap.sh
sudo DOKKU_TAG=v0.20.4 bash bootstrap.sh
@worldofprasanna
worldofprasanna / blog_staticwebsite_s3.tf
Last active May 3, 2020
Create S3 bucket to hold static assets
View blog_staticwebsite_s3.tf
resource "aws_s3_bucket" "main" {
...
policy = data.aws_iam_policy_document.bucket_policy.json
website {
index_document = var.index_document
}
...
data "aws_iam_policy_document" "bucket_policy" {
...
actions = [
@worldofprasanna
worldofprasanna / main.tf
Last active May 3, 2020
Terraform script to serve your static assets
View main.tf
module "staticwebsite" {
source = "worldofprasanna/staticwebsite/aws"
version = "1.0.0"
domain = "yourdomain.com"
}
# To create the resource,
terraform apply
# To upload the static assests,
aws s3 sync build/ s3://yourdomain.com
@worldofprasanna
worldofprasanna / terraform_issue_aws_s3_object.log
Last active May 2, 2020
Terraform issue when creating aws_s3_object
View terraform_issue_aws_s3_object.log
2020/05/02 19:50:54 [INFO] Terraform version: 0.12.24
2020/05/02 19:50:54 [INFO] Go runtime version: go1.13.8
2020/05/02 19:50:54 [INFO] CLI args: []string{"/usr/local/bin/terraform", "apply"}
2020/05/02 19:50:54 [DEBUG] Attempting to open CLI config file: /Users/prasanna/.terraformrc
2020/05/02 19:50:54 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2020/05/02 19:50:54 [INFO] CLI command args: []string{"apply"}
2020/05/02 19:50:54 [TRACE] Meta.Backend: no config given or present on disk, so returning nil config
2020/05/02 19:50:54 [TRACE] Meta.Backend: backend has not previously been initialized in this working directory
2020/05/02 19:50:54 [DEBUG] New state was assigned lineage "39f352e1-5d2f-f7a4-b2ff-273d5267b668"
2020/05/02 19:50:54 [TRACE] Meta.Backend: using default local state only (no backend configuration, and no existing initialized backend)
@worldofprasanna
worldofprasanna / download_apk.py
Created Nov 22, 2019
Download APK files from google play store
View download_apk.py
import sys
import os
from gpapi.googleplay import GooglePlayAPI
def main():
server = GooglePlayAPI('en_US', 'America/New York', 'bacon')
try:
server.login(email="<gmail userid>", password="<gmail password>")
storagepath = '/tmp/'
download = server.download('com.whatsapp', expansion_files=False)
View recursive-queries.sql
Schema:
Entity:
- id
- name
- parent
Sample Data:
╔══════╦══════╦════════╗
║ id ║ name ║ parent ║