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 / adb_copy.sh
Last active August 7, 2025 08:57
Shell script to copy only new files using adb
# path to folder on the device
PHONE_PATH=/storage/self/primary/DCIM/Camera/
# path to copy files to
LOCAL_PATH=~/Camera/
# get list of files from the phone folder
adb shell ls -l $PHONE_PATH > file_list.txt
# filter only jpg and mp4 files
@niraj-shah
niraj-shah / cors.json
Created March 26, 2024 12:20
AWS S3 CORS Policy
[
{
"AllowedHeaders": [],
"AllowedMethods": [
"GET"
],
"AllowedOrigins": [
"*"
],
"ExposeHeaders": []
@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 25, 2024 00:30
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