Skip to content

Instantly share code, notes, and snippets.

View pawneetdev's full-sized avatar
☠️

Pawneet Singh pawneetdev

☠️
View GitHub Profile
@pawneetdev
pawneetdev / srapy_install
Last active July 12, 2016 11:06
Installing scrapy and scrapyd
1.) wget https://bootstrap.pypa.io/get-pip.py
2.) sudo python get-pip.py
3.) sudo apt-get update
3.) sudo apt-get install build-essential libssl-dev libffi-dev python-dev libxml2-dev libxslt1-dev libldap2-dev libsasl2-dev libpq-dev python-dev
4.) sudo pip install Scrapy
5.) sudo pip install scrapyd
@pawneetdev
pawneetdev / Boto3
Created November 22, 2016 08:29
AWS SDK boto3 python
################# Getting started ##################
1.) pip install boto3
2.) Create credentials file at ~/.aws/credentials
[default]
aws_access_key_id = YOUR_ACCESS_KEY
aws_secret_access_key = YOUR_SECRET_KEY
3.) Create config file at ~/.aws/config
[default]
region=us-east-1
####################################################
For deploying the code from your IAM profile:
1.) Create credentials file at ~/.aws/credentials
[default]
aws_access_key_id = YOUR_ACCESS_KEY
aws_secret_access_key = YOUR_SECRET_KEY
2.) Create config file at ~/.aws/config
[default]
region=us-east-1
3.) appName > .elasticbeanstalk > config.yml
@pawneetdev
pawneetdev / Using Beanstalk with git
Created November 22, 2016 17:33
For using deploying only the changes, not the whole repository to AWS beanstalk
1.) Reinitialize git repository once:
git init
2.) Use the following the command to push the staged changes only:
eb deploy --staged
@pawneetdev
pawneetdev / S3 ACL read
Last active May 14, 2018 04:54
Set public read permission on files in a folder AWS S3 using boto3
import boto3
s3 = boto3.resource('s3')
bucket = s3.Bucket('bucket_name_here')
for obj in bucket.objects.filter(Prefix='folder_name_here'):
obj.Acl().put(ACL='public-read')
@pawneetdev
pawneetdev / 0000_packages.config
Created November 12, 2018 07:17 — forked from gcarrion-gfrmedia/0000_packages.config
AWS Elastic Beanstalk Ruby 2.0/Puma Environment - .ebextensions tweaks and Sidekiq configuration. This is known to work fine with AWS Elastic Beanstalk 's 64bit Amazon Linux 2014.03 v1.0.1 running Ruby 2.0 (Puma) stack. Later stack versions might not work, but for that specific version works fine.
# Install Git needed for Git based gems
packages:
yum:
git: []
ssh-add ~/.ssh/KEY_PAIR_NAME.pem
@pawneetdev
pawneetdev / Searchkick
Created July 30, 2019 03:54
Searchkick queries
1. To delete an index from ES
Searchkick.client.indices.delete(index: name)
2. To promote new index
Product.search_index.promote(index_name)
sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
sudo /sbin/mkswap /var/swap.1
sudo chmod 600 /var/swap.1
sudo /sbin/swapon /var/swap.1