Skip to content

Instantly share code, notes, and snippets.

View itsprdp's full-sized avatar

Pradeep Gangadharaiah itsprdp

View GitHub Profile
@itsprdp
itsprdp / tv_series.md
Last active September 20, 2017 02:40
TV Series I have watched till date

Completed

24
Band of Brothers
Breaking Bad
Dexter
Golaith
Friends
HIMYM

@itsprdp
itsprdp / setup
Last active November 10, 2015 10:00
Create postgres superuser with no password for login
####################################################
# WARNING: Don't use this on production environments
####################################################
# Login to psql terminal with postgres user
psql -U postgres
DROP ROLE root; # Run this if role root already exists
CREATE ROLE root WITH SUPERUSER LOGIN PASSWORD NULL;
createdb root;
@itsprdp
itsprdp / carrier_wave.rb
Created November 12, 2015 11:06 — forked from gshaw/carrier_wave.rb
CarrierWave initialization file for testing with fixtures and support S3 in staging and production.
# NullStorage provider for CarrierWave for use in tests. Doesn't actually
# upload or store files but allows test to pass as if files were stored and
# the use of fixtures.
class NullStorage
attr_reader :uploader
def initialize(uploader)
@uploader = uploader
end
@itsprdp
itsprdp / git-clone-and-check-out-to-latest.sh
Last active December 21, 2015 10:40
Clone the git repo and checkout to latest tag/release version
git clone <git-url> <dest-dir>
cd <dest-dir>
git checkout tags/$(git tag -l | tail -1)
@itsprdp
itsprdp / Dockerfile.rails-base
Last active September 9, 2016 04:21
RubyApp Dockerfile for staging
# Building rails-base image for the rubyapp
FROM phusion/passenger-ruby22
MAINTAINER Pradeep "[email protected]"
# Set correct environment variables.
ENV HOME /root
# Use baseimage-docker's init process.
CMD ["/sbin/my_init"]
@itsprdp
itsprdp / gcloud-kubectl-commands.txt
Last active January 14, 2016 08:45
GCE-container engine commands
# Init project settings
$ gcloud config set project PROJECT_ID
$ gcloud config set compute/zone us-east1-b
$ export PROJECT_ID=your-project-id-here
# Build docker image and push it to gcr.io
$ docker build -t gcr.io/${PROJECT_ID}/<project-name> .
Then push this image to the Google Container Registry:
$ gcloud docker push gcr.io/${PROJECT_ID}/<project-name>
@itsprdp
itsprdp / psql-mysql.taps
Created January 14, 2016 06:51
Using https://github.com/ricardochimal/taps to migrate data from Postgres to MySQL
# Serve the MySQL database (destination db)
taps server mysql://<user>:<pass>@localhost/<database> user1 pass123
# Push the schema and the records of the database to destination db
taps push postgres://<user>:<pass>@localhost/<database> http://user1:pass123@localhost:5000
@itsprdp
itsprdp / Dockerfile
Last active September 9, 2016 04:22
Kuber files for Rails App + Google Container Engine
# Dockerfile
# Using phusion passenger as base image.
# Refer - https://github.com/phusion/passenger-docker
FROM phusion/passenger-ruby22:latest
MAINTAINER Pradeep <[email protected]>
# Set ENV variables
ENV HOME /rubyapp/
@itsprdp
itsprdp / kuber-secret.rb
Last active January 18, 2016 15:40
Convert your .env file data to JSON key with values encoded to base64
#!/usr/bin/env ruby
# Encode .env file values to base64 and create json key values
require 'base64'
require 'yaml'
if ARGV[0]
env = {}
file = File.new(ARGV[0], "r")
@itsprdp
itsprdp / readonly.yml
Created February 2, 2016 10:42
Mount Persistent Disk to a container
kind: Pod
apiVersion: v1
metadata:
name: readonly-pod
spec:
containers:
- name: readonly-pod
image: nginx
volumeMounts:
- mountPath: /etc/secrets