Skip to content

Instantly share code, notes, and snippets.

View amitavroy's full-sized avatar
🏠
Working from home

Amitav Roy amitavroy

🏠
Working from home
View GitHub Profile
@amitavroy
amitavroy / aws_ec2_start_stop.json
Last active January 23, 2024 10:15
AWS EC2 Start Stop Lambda
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"ec2:Start*",
"ec2:Stop*",
"ec2:DescribeInstanceStatus"
@amitavroy
amitavroy / LEMP Stack
Last active October 20, 2023 00:55
Setup for a new linux server with Nginx PHP and MySQL
# Basics
sudo apt-get update
sudo apt-get install -y git tmux vim curl wget zip unzip htop
# Nginx
sudo apt-get install -y nginx
# PHP
sudo add-apt-repository ppa:nginx/stable
sudo add-apt-repository -y ppa:ondrej/php
@amitavroy
amitavroy / .php-cs-fixer.php
Created December 5, 2021 08:34
php cs fixer rules for Laravel
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'default' => 'single_space',
'operators' => ['=>' => null],
@amitavroy
amitavroy / button.tsx
Last active May 10, 2022 04:14
Some useful React codes
// A sample button component with proper Typescript definitions
// and it also spreads all props coming from the parent component
import { HTMLAttributes, ReactNode } from "react";
interface Props extends HTMLAttributes<HTMLButtonElement> {
children: ReactNode;
variant: "primary" | "secondary";
}
@amitavroy
amitavroy / Dockerfile
Created November 18, 2018 04:10
Docker setup with Laravel
FROM php:7.2.10-apache-stretch
RUN apt-get update -yqq && \
apt-get install -y apt-utils zip unzip && \
apt-get install -y nano && \
apt-get install -y libzip-dev libpq-dev && \
a2enmod rewrite && \
docker-php-ext-install pdo_pgsql && \
docker-php-ext-install pgsql && \
docker-php-ext-configure zip --with-libzip && \
@amitavroy
amitavroy / Fileupload.vue
Created November 19, 2018 16:35
Vue.js component for a File field which makes an Ajax request to server
<template>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card card-default">
<div class="card-header">Example Component</div>
<div class="card-body upload-file-wrapper">
<input
type="file"
@amitavroy
amitavroy / docker_on_ubuntu.sh
Last active December 4, 2021 08:54
Installing Docker on a new Ubuntu Server
sudo apt update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
@amitavroy
amitavroy / Dockerfile
Created November 23, 2021 01:54
Composer PHP 7.4 Docker file
FROM phpdockerio/php74-cli as php
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
WORKDIR /app
CMD ["composer"]
@amitavroy
amitavroy / TimeEntrySeeder.php
Created August 15, 2020 06:09
Get a lot of Time Entries
<?php
/** @var \Illuminate\Database\Eloquent\Factory $factory */
use App\TimeEntry;
use Faker\Generator as Faker;
$factory->define(TimeEntry::class, function (Faker $faker) {
$username = [
'Amitav',
# Installing Apache, PHP and MySQL
sudo apt install -y apache2
sudo add-apt-repository -y ppa:ondrej/php
sudo apt-get update
sudo apt install -y zip unzip git curl
sudo apt-get install -y php7.3-fpm php7.3-cli php7.3-gd php7.3-mysql \
php7.3-mbstring php7.3-xml php7.3-curl \
php7.3-bcmath php7.3-sqlite3 php7.3-zip