Skip to content

Instantly share code, notes, and snippets.

View shankar-bavan's full-sized avatar

Shankar S Bavan shankar-bavan

View GitHub Profile
@shankar-bavan
shankar-bavan / Resize VirtualBox Ubuntu
Created September 6, 2019 04:06
Resize a VirtualBox guest Linux VDI Disk under Windows Host
1. Shut down VirtualBox.
2. Make a copy of the VDI file – just in case (“MyLinux.vdi” -> “MyLinuxCopy.vdi“)
3. Go into the Windows command prompt (Start->type “cmd” into the box)
4. cd to the location of the VDI file that you wish to resize, e.g., “d:\MyLinux.vdi“
5. At the Windows command prompt, type:
D:\>VBoxmanage modifyhd MyLinux.vdi --resize 100000
this will re-size the drive to 100 GB. Pick a value that suits you. Note, your vdi file will not change in size at this point.
The output should look like:
D:\>VBoxmanage modifyhd MyLinux.vdi --resize 100000
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
@shankar-bavan
shankar-bavan / Get Categories on page
Created September 6, 2019 04:11
WordPress Display Categories on Page
<?php
$args = array(
'type' => 'post',
'parent' => 0, // Gets only top level categories
'orderby' => 'count', // Orders the list by post count
'order' => 'desc',
'hide_empty' => 1, // Hides categories with no posts
'number' => 4, // No of categories to return
'taxonomy' => 'category'
);
@shankar-bavan
shankar-bavan / Mongo-DB-laravel-login.md
Created September 14, 2019 06:04
Mongo DB laravel authentication with jenssegers-mongodb

Install using composer:

composer require jenssegers/mongodb-session

config/app.php

'providers' => [
Jenssegers\Mongodb\MongodbServiceProvider::class,
@shankar-bavan
shankar-bavan / Mongodb.md
Last active September 17, 2019 09:01
MongoDB Commands

Connect to MongoDB Shell

mongo

Exit the mongo Shell

quit()
@shankar-bavan
shankar-bavan / create-laravel-package.md
Last active February 25, 2024 21:59
How to Build Laravel Package

Step #1: Install Laravel

Install the latest Laravel version i.e. Laravel 5.8. To do so go to the project directory and run the command:

composer create-project --prefer-dist laravel/laravel

Step #2: Create Package Directory

create folder from laravel root directory with this structure:

@shankar-bavan
shankar-bavan / laravel-packagist.md
Created September 26, 2019 06:27
upload laravel package on packagist

create a repository on github

open terminal inside package folder "packages/devlabs/todolist"

run following commands on terminal

git init
git status
git add .
@shankar-bavan
shankar-bavan / laravel-queue-worker-with-supervisor.md
Last active February 4, 2024 15:20
Laravel Queue worker with Supervisor

1. Installing Supervisor on Linux

To install supervisor, use the following command.

sudo apt-get install supervisor

2. Supervisor configuration for Laravel

After installation, create supervisor configuration file with instructions to run the processes. To create a configuration file, execute the following command. sudo nano /etc/supervisor/conf.d/project-name-queue-worker.conf

@shankar-bavan
shankar-bavan / instagram-feed.php
Last active April 19, 2022 07:01
instagram feed with PHP
$instaResult = file_get_contents('https://www.instagram.com/'.$username.'/?__a=1');
$insta = json_decode($instaResult);
$instagram_photos = $insta->graphql->user->edge_owner_to_timeline_media->edges;
//view with foreach loop.
<ul>
@foreach($instagram_photos as $instagram_photo)
<li>
@shankar-bavan
shankar-bavan / bitbucket-pipeline-pull-files.md
Last active June 9, 2023 16:35
CI CD with bitbucket pipleline and shell script
@shankar-bavan
shankar-bavan / apache-sql-server-guide.md
Last active June 8, 2024 08:42
Ubuntu server setup guide

Install Apache

sudo apt-get update -y
sudo apt-get upgrade -y

Install and start Apache.