Skip to content

Instantly share code, notes, and snippets.

View niraj-shah's full-sized avatar
🏠
Working from home

Niraj Shah niraj-shah

🏠
Working from home
View GitHub Profile
@niraj-shah
niraj-shah / suspended.tmpl
Created June 9, 2023 10:17
cPanel Account Suspension Page
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Account Suspended</title>
<!-- Fonts -->
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"ec2:RevokeSecurityGroupIngress",
"ec2:AuthorizeSecurityGroupEgress",
"ec2:AuthorizeSecurityGroupIngress",
@niraj-shah
niraj-shah / lfd-v2.php
Last active March 3, 2020 03:23
LFD Reporting Script using Abuse IP DB v2 API
#!/usr/local/bin/php
<?php
// AbuseIPDB API v2 Key
$api_key = 'xxx';
// AbuseIPDB API v2 Endpoint
$api_endpoint = 'https://api.abuseipdb.com/api/v2/';
// AbuseIPDB User ID
#!/usr/local/bin/php
<?php
// get command line arguments
$args = $argv;
// AbuseIPDB API Key
$api_key = 'xxx';
// your AbuseIPDB User ID
@niraj-shah
niraj-shah / sequential.js
Created October 8, 2018 16:18
Sequential Ajax Calls using jQuery
// parameters for ajax calls
var items = [
{ 'gender': 'male', 'nat': 'US' },
{ 'gender': 'female', 'nat': 'GB' }
];
// function to trigger the ajax call
var ajax_request = function(item) {
var deferred = $.Deferred();
@niraj-shah
niraj-shah / PasswordProtectPDF.php
Last active August 15, 2018 21:39
Password Protecting PDFs using PHP
<?php
require "vendor/autoload.php";
use setasign\Fpdi\Fpdi;
use setasign\Fpdi\PdfReader;
use setasign\FpdiProtection\FpdiProtection;
class PasswordProtectPDF
{
protected $pdf = null;
@niraj-shah
niraj-shah / htaccess
Last active July 19, 2018 10:12
WordPress .htaccess Restrictions
# .htaccess file for root WordPress directory
# add this line if it's not already present in your .htaccess file
ErrorDocument 401 default
<Files "wp-login.php">
AuthName "WordPress Admin"
AuthUserFile "/path/to/passwd"
AuthType Basic
require valid-user
@niraj-shah
niraj-shah / download_svn.sh
Last active May 10, 2018 15:21
SVN Setup on EasyApache4
# move to home directory
cd ~/
# download svn source
wget https://archive.apache.org/dist/subversion/subversion-1.7.14.tar.bz2
# extract source
tar -xzvf subversion-1.7.14.tar.bz2
# enter extracted directory
@niraj-shah
niraj-shah / mydomain-ssl.conf
Last active March 21, 2018 15:35
Apache2 vhost and site config setup. `mydomain-ssl.conf` is the SSL site conf, `mydomain.conf` is the regular site conf, and `mydomain.vhost` is the vhost found in `/etc/apache2/conf/vhosts`.
<IfModule mod_ssl.c>
<VirtualHost *:443>
Include conf/vhosts/mydomain.vhost
SSLCertificateFile /etc/letsencrypt/live/mydomain.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/mydomain.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
<IfModule mod_ssl.c>
<VirtualHost *:443>
Include conf/vhosts/domain.vhost
SSLCertificateFile /etc/letsencrypt/live/domain.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/domain.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>