Skip to content

Instantly share code, notes, and snippets.

View izshreyansh's full-sized avatar
💭
Writing code doesn't bug me, I'm the one that BUG the code.

Shreyansh Panchal izshreyansh

💭
Writing code doesn't bug me, I'm the one that BUG the code.
View GitHub Profile
@izshreyansh
izshreyansh / README
Last active August 12, 2019 14:17
Laravel Deployment Checklist
# laravel-deployment
- [ ] Install apache
- `sudo systemctl start apache2`: Manage apache [stop,status,restart,reload,disable,enable]
- [Install apache](https://www.digitalocean.com/community/tutorials/how-to-install-the-apache-web-server-on-ubuntu-18-04)
- `sudo a2enmod rewrite` enable mod rewrite
- `<Directory /var/www/domain.com/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
@izshreyansh
izshreyansh / .bash_aliases
Last active February 29, 2020 05:38
Important bash commands for prod
alias ..="cd .."
alias ...="cd ../.."
alias h='cd ~'
alias c='clear'
alias art=artisan
alias codecept='vendor/bin/codecept'
alias phpspec='vendor/bin/phpspec'
alias phpunit='vendor/bin/phpunit'
@izshreyansh
izshreyansh / code.md
Created September 11, 2019 14:11
Laravel Test Mail
Mail::send('errors.500', [], function($message) 
{
  $message->to('[email protected]')->subject('Testing mails');
});
Just do this: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html#replacing-lost-key-pair
Here is what I did, thanks to Eric Hammond's blog post:
Stop the running EC2 instance
Detach its /dev/xvda1 volume (let's call it volume A) - see here
Start new t1.micro EC2 instance, using my new key pair. Make sure you create it in the same subnet, otherwise you will have to terminate the instance and create it again. - see here
Attach volume A to the new micro instance, as /dev/xvdf (or /dev/sdf)
SSH to the new micro instance and mount volume A to /mnt/tmp
@izshreyansh
izshreyansh / init.sh
Created February 2, 2020 13:48
Initialize new sql for lamp stack
sudo apt-get update -y
sudo apt-get upgrade -y
cd ~
sudo fallocate -l 4G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo sysctl vm.swappiness=10
sudo sysctl vm.vfs_cache_pressure=50
@izshreyansh
izshreyansh / server.com
Last active September 23, 2021 09:07
nginx-server-block
server {
listen 80 default_server;
server_name server.com;
root "/var/www/server/public";
index index.html index.htm index.php;
charset utf-8;
location / {
@izshreyansh
izshreyansh / test.js
Created August 1, 2020 16:18
firestore Sharding in vue
createCounter: function (ref, num_shards) {
let batch = db.batch();
// Initialize the counter document
batch.set(ref, { num_shards: num_shards });
// Initialize each shard with count=0
for (let i = 0; i < num_shards; i++) {
let shardRef = ref.collection('shards').doc(i.toString());
batch.set(shardRef, { count: 0 });
let algoliasearch = require('algoliasearch');
let client = algoliasearch(process.env.MIX_ALGOLIA_APP_ID, process.env.MIX_ALGOLIA_SECRET);
let products = client.initIndex('products');
let ebay_orders = client.initIndex('ebay_orders');
let ebay_products = client.initIndex('ebay_products');
let amazon_orders = client.initIndex('amazon_orders');
let amazon_products = client.initIndex('amazon_products');
$('#magicSearch').autocomplete(
@izshreyansh
izshreyansh / README.md
Last active October 12, 2020 10:57
Laravel Best Practices
  • Every modification in .env file needs to be replicated in .env.example.

Ex: .env file is never commited into the repository, So 3rd developer will never know valid values to pass through in .env.

  • If css class can be traced with relationships, Don't introduce a new class.
<ul class="list-holder">
<li class="list-item">Item 1</li>
</ul>