Skip to content

Instantly share code, notes, and snippets.

View vpadhariya's full-sized avatar

Vijay Padhariya vpadhariya

View GitHub Profile
@vpadhariya
vpadhariya / .htaccess
Created August 8, 2018 14:17
Apache Various Compression Techniques via .htaccess
<IfModule mod_mime.c>
AddType text/css .css
AddType text/x-component .htc
AddType application/x-javascript .js
AddType application/javascript .js2
AddType text/javascript .js3
AddType text/x-js .js4
AddType text/html .html .htm
AddType text/richtext .rtf .rtx
AddType image/svg+xml .svg .svgz
@vpadhariya
vpadhariya / sanitize_output.php
Created August 23, 2018 11:18
Sanitize output of html, remove html, css, js comments and trim output.
<?php
/*
* Compressing the HTML Output
*/
function sanitize_output($buffer)
{
$search = array(
'/\>[^\S ]+/s', // strip whitespaces after tags, except space
'/[^\S ]+\</s', // strip whitespaces before tags, except space
@vpadhariya
vpadhariya / YoutubeCommand.php
Created September 17, 2019 17:25
Youtube Data search and parsing
<?php
//require_once('modules/admin/models/ServiceProvider.php');
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
class YoutubeCommand extends CConsoleCommand
@vpadhariya
vpadhariya / security.php
Created July 27, 2021 13:33
WordPress Security Rules as mu-plugins (put this file under wp-content/mu-plugins/security.php and you are done)
<?php
/*
Plugin Name: WP Security Rules
Plugin URI: https://digitize-info.com
Description: Here we will define the site wise security rules
Version: 0.3
Author: Vijay Padhariya
Author URI: https://vijaypadhariya.com
*/

Awesome-Selfhosted

Awesome

Selfhosting is the process of locally hosting and managing applications instead of renting from SaaS providers.

This is a list of Free Software network services and web applications which can be hosted locally. Non-Free software is listed on the Non-Free page.

See Contributing.

@vpadhariya
vpadhariya / https-for-express-node-server.js
Created January 6, 2024 04:30
Here how we can enable https server for Express Node Server
const express = require('express');
var bodyParser = require('body-parser')
const mongoose = require('mongoose');
const routes = require('./routes/routes');
// for HTTP and HTTPS listening
var fs = require('fs');
var http = require('http');
var https = require('https');
var privateKey = fs.readFileSync('{PATH TO PRIVATE KEY}/privkey.pem', 'utf8');