Skip to content

Instantly share code, notes, and snippets.

View nasirkhan's full-sized avatar
🚀
Focusing

Nasir Khan Saikat nasirkhan

🚀
Focusing
View GitHub Profile
@nasirkhan
nasirkhan / auto-deploy.php
Last active December 5, 2023 16:47
Deploy to Production Server with Git Webhook using PHP. Configure a Webhook, push to repository and new code will be deployed automatically. Tested with Github, Gitlab webhook auto triggers.
<?php
/**
*
* GIT AUTO DEPLOYMENT SCRIPT
*
* GITHUB? GITLAB webhook
* -------------------------------
*
*/
@nasirkhan
nasirkhan / config.sh
Created November 8, 2019 05:51
Redirect www to non www domain
## Virtual Host Config
```
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin webmaster@localhost
ServerName matholympiad.org.bd
ServerAlias www.matholympiad.org.bd
@nasirkhan
nasirkhan / joomla-ubuntu.sh
Last active January 29, 2019 10:52
Joomla File Folder Permission on Ubuntu server
#!/bin/bash
#
# Fix the folder and file permissions for Joomla installation on Ubuntu server
sudo chown -R www-data.www-data /var/www/html/joomla
sudo chmod -R 755 /var/www/html/joomla
# Following command endabled to option to update the extensions and core joomla cms as well.
# after updating need to fix the permission using the commands mentioned above.
sudo chown $USER:www-data -R /var/www/html/joomla
@nasirkhan
nasirkhan / TagController.php
Created April 7, 2018 06:29 — forked from FilipQL/TagController.php
Select2 and Laravel: Ajax Autocomplete
<?php
/* For more details see: http://laraget.com/blog/select2-and-laravel-ajax-autocomplete */
namespace App\Http\Controllers\Select2Ajax;
use App\Tag;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
class TagController extends Controller
@nasirkhan
nasirkhan / request_basicauth.js
Last active March 2, 2018 11:22 — forked from fchasen/request_basicauth.js
Loading this script after epub.js and it should overwrite the EPUBJS.core.request method.Change the login credentials in the file to your servers.USERNAME = 'abc'PASSWORD = 'xyz'
USERNAME = 'abc'
PASSWORD = 'xyz'
EPUBJS.core.request = function(url, type) {
var supportsURL = window.URL;
var BLOB_RESPONSE = supportsURL ? "blob" : "arraybuffer";
var deferred = new RSVP.defer();
var xhr = new XMLHttpRequest();
@nasirkhan
nasirkhan / pagespeed_optimize_images.sh
Created December 6, 2017 04:57 — forked from julianxhokaxhiu/pagespeed_optimize_images.sh
Recursively optimize all PNG and JPG files wherever they are from the script position and inner ( based on OPTING, PNGCRUSH, ADVANCECOMP and JPEGOPTIM )
#!/bin/bash
find . -type f -name "*.png" -o -name "*.PNG" | xargs optipng -nb -nc
find . -type f -name "*.png" -o -name "*.PNG" | xargs advpng -z4
find . -type f -name "*.png" -o -name "*.PNG" | xargs pngcrush -rem gAMA -rem alla -rem cHRM -rem iCCP -rem sRGB -rem time -ow
find . -type f -name "*.jpg" -o -name "*.JPG" | xargs jpegoptim -f --strip-all
# initialization file (not found)
@nasirkhan
nasirkhan / Envoy.blade.php.md
Last active August 3, 2021 13:43
Deploying with Envoy

SSH Keys

SSH keys provide a more secure way of logging into a virtual private server with SSH than using a password alone. While a password can eventually be cracked with a brute force attack, SSH keys are nearly impossible to decipher by brute force alone. Generating a key pair provides you with two long string of characters: a public and a private key. You can place the public key on any server, and then unlock it by connecting to it with a client that already has the private key. When the two match up, the system unlocks without the need for a password. You can increase security even more by protecting the private key with a passphrase.

https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys--2

Step One—Create the RSA Key Pair

The first step is to create the key pair on the client machine (there is a good chance that this will just be your computer):

@nasirkhan
nasirkhan / bengali-webfont.md
Last active February 19, 2020 03:50
Embed Bengali/ Bangla Webfonts with Unicode Range
/* ========================================================================
    Bengali/ Bangla Webfont
    Embed Bengali Webfonts with Unicode Range
	Fonts are hosted at http://nasirkhn.com
 ========================================================================== */

@font-face {
	font-family: 'Siyam Rupali';
	font-style: normal;
@nasirkhan
nasirkhan / zip-split-unzip.md
Last active December 21, 2023 16:26
Split a Zip file and combine and unzip next linux

You have existing.zip but want to split it into 50M sized parts.

zip existing.zip --out new.zip -s 50m

will create

new.zip