Skip to content

Instantly share code, notes, and snippets.

View kundancool's full-sized avatar
💭
I may be slow to respond.

Kundan kundancool

💭
I may be slow to respond.
View GitHub Profile
@kundancool
kundancool / alpine-php83-setup.sh
Created September 14, 2025 16:52
A shell script to install and configure PHP 8.3 with PHP-FPM, Redis, and common extensions on Alpine Linux. It ensures a www-data user/group exists, configures PHP-FPM to use a secure UNIX socket, and installs a wide range of useful PHP extensions for server environments.
#!/bin/sh
# Alpine PHP 8.3 installation and configuration script
# Run as root
set -e
# -------------------------------
# Install PHP 8.3 + common extensions
# -------------------------------
install_php() {
@kundancool
kundancool / configure-alpine.sh
Created September 14, 2025 16:34
Improve base alpine install
#!/bin/sh
# Alpine Linux Server Enhancement Script
# Structured with functions
# Run as root
set -e
# -------------------------------
# Update & upgrade system
# -------------------------------
#!/bin/bash
# ================================
# 🛡️ MySQL Backup & Restore Tool 🛡️
# -------------------------------
# - Configurable via CLI or file 📄
# - Upload/download to/from S3 ☁️
# - Super cool messages 🚀
# ================================
@kundancool
kundancool / zsh-timestamp.md
Created February 18, 2022 12:54 — forked from zulhfreelancer/zsh-timestamp.md
How to add timestamp on right hand side of ZSH / iTerm2 terminal prompt?

Add the following snippet at the bottom of ~/.zshrc file.

Option 1 - Just time

RPROMPT='[%D{%L:%M:%S}] '$RPROMPT
@kundancool
kundancool / Dockerfile
Created November 13, 2021 13:44
laravel-php7.4-fpm-alpine
# Base Image
FROM php:7.4-fpm-alpine
# Update system packages
RUN apk update && apk upgrade
# Install required pacjages
RUN apk add --no-cache nano vim nginx composer supervisor npm git htop \
bzip2-dev zlib-dev libpng icu-dev libxml2-dev \
freetype libpng libjpeg-turbo freetype-dev libpng-dev libjpeg-turbo-dev gettext-dev \
@kundancool
kundancool / darken.js
Last active November 7, 2020 13:24
darken.js
javascript: (function() {
var newSS, styles = '* { background: #282b2e ! important; color: #e0e2e4 !important } :link, :link * { color: #2868C7 !important } :visited, :visited * { color: #dddddd !important }';
if (document.createStyleSheet) {
document.createStyleSheet("javascript:'" + styles + "'");
} else {
newSS = document.createElement('link');
newSS.rel = 'stylesheet';
newSS.href = 'data:text/css,' + escape(styles);
document.getElementsByTagName("head")[0].appendChild(newSS);
}
{
"shell_cmd": "php-cs-fixer fix --rules=@Symfony,array_indentation --using-cache=false $file",
"file_regex": "php$"
}
@kundancool
kundancool / GoogleSheetController.php
Last active April 6, 2019 16:45
Google Sheet Controller for Laravel
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class GoogleSheetController extends Controller
{
protected $sheets;
@kundancool
kundancool / length-aware-paginator.php
Created May 10, 2018 08:33
Laravel Length Aware Pagination for custom array
<?php
public function sampleArrayPaginator(Request $request) {
$response = array();
$page = ($request->has('page')) ? intval($request->page) : 1;
$size = ($request->has('size')) ? intval($request->size) : 10;
$collection = collect($response);
$total = $collection->count();
return new LengthAwarePaginator(
array_values($collection->forPage($page, $size)->toArray()),
$collection->count(),
@kundancool
kundancool / dawnwing-co-za-api.php
Created August 21, 2017 13:34
[PHP] dawnwing.co.za Tracking scrapper
<?php
/**
* Tracking package via cURL from www.dawnwing.co.za
*
* @author Kundan K Singh <kundandeveloper@gmail.com>
*/
define('DOMAIN_REQUEST_URL', 'http://www.dawnwing.co.za/business-tools/online-parcel-tracking/');
include_once 'simple_html_dom.php';