Skip to content

Instantly share code, notes, and snippets.

View niteshpurohit's full-sized avatar

Nitesh Purohit niteshpurohit

View GitHub Profile
find . -name "node_modules" -type d -prune | xargs du -chs
@niteshpurohit
niteshpurohit / run.sh
Created August 27, 2020 10:18
aws eb docker config sh
echo "{\"AWSEBDockerrunVersion\":\"1\",\"Image\":{\"Name\":\"$REPOSITORY_URI:$RELEASE_TAG\",\"Update\":\"true\"},\"Ports\":[{\"ContainerPort\":\"5000\"}],\"Logging\":\"/var/log\"}" > Dockerrun.aws.json
@niteshpurohit
niteshpurohit / ruby
Created December 4, 2019 16:17
Docker
FROM ruby:2.6.3-alpine3.9
RUN apk update && apk add libpq nodejs
ENV RAILS_ROOT /app
RUN mkdir -p $RAILS_ROOT
ENV BUNDLER_VERSION 2.0.2
WORKDIR $RAILS_ROOT
RUN echo 'gem: --no-ri --no-rdoc' > ~/.gemrc
COPY Gemfile Gemfile
COPY Gemfile.lock Gemfile.lock
RUN apk add --virtual build-dependencies build-base gcc wget git postgresql-dev \
@niteshpurohit
niteshpurohit / Ubuntu_18_lamp.sh
Last active April 16, 2019 12:59
ubuntu_18_lamp
#!/bin/bash
echo "GOT $1 $2"
sleep 4
export DEBIAN_FRONTEND=noninteractive
apt update
echo "Install Apache2"
sleep 2
@niteshpurohit
niteshpurohit / aws_linux2_ami_php_server_with_letsencrypt.md
Last active August 30, 2018 07:40
Setup PHP Server with Letsencrypt

php and mods

sudo yum install -y php

sudo yum install -y php-zip php-xml php-gd

httpd

sudo yum install -y httpd

@niteshpurohit
niteshpurohit / Remove all git tags
Created May 18, 2017 09:27 — forked from okunishinishi/Remove all git tags
Delete all git remote tags
#Delete local tags.
git tag -l | xargs git tag -d
#Fetch remote tags.
git fetch
#Delete remote tags.
git tag -l | xargs -n 1 git push --delete origin
#Delete local tasg.
git tag -l | xargs git tag -d
@niteshpurohit
niteshpurohit / flat_it
Last active January 21, 2017 14:47
Flatten Array with using inbuilt method
class Array #class so that this method is available for array. monkey patching
def flat_it
each_with_object([]) do |element, flattened| #traverse each element
flattened.push *(element.is_a?(Array) ? element.flat_it : element) #call method if Array, push to flattened if not array
end
end
end
#usage
[1,2,3,4,[1,2,3,4,[1,2,[44,34]]],5].flat_it