Skip to content

Instantly share code, notes, and snippets.

View rahul286's full-sized avatar
😷

Rahul Bansal rahul286

😷
View GitHub Profile
@rahul286
rahul286 / azure-blob-xplat-cli-sample
Last active October 28, 2015 14:26 — forked from mwinkle/azure-blob-xplat-cli-sample
Azure XPlat CLI in order to list and download blobs
# first, make sure you have downloaded the Azure XPlat CLI
# http://azure.microsoft.com/en-us/documentation/articles/xplat-cli/#install
# eg, sudo npm install azure-cli -g
# login to Azure (will prompt for your username/password or will ask you to open link http://aka.ms/devicelogin in browser)
azure login
# optional - if you have multiple accounts
## list subscriptions
azure account list
@rahul286
rahul286 / mac-osx-el-captain-commands.sh
Last active September 24, 2024 03:11
Updating to Mac elCapitan using downloaded pkg file
## based on https://github.com/lioonline/OS-X-El-Capitan
## pkg file link - http://osxapps.itunes.apple.com/apple-assets-us-std-000001/Purple3/v4/74/d2/82/74d28291-9db9-7ae2-305d-9b8b3f5fd463/ftk3252456602304584541.pkg
# Run this from folder where you have downloaded or copied ftk3252456602304584541.pkg file
#create a tmp folder
mkdir elCapitanRoot && cd elCapitanRoot
#create a folder structure to match apple server
sudo mkdir -p ./apple-assets-us-std-000001/Purple3/v4/74/d2/82/74d28291-9db9-7ae2-305d-9b8b3f5fd463/
@rahul286
rahul286 / curloop.sh
Created October 16, 2015 10:01
Hitting a URL via CURL in infinite loop with user agent and referrer header
while 1; do curl --referer "http://google.com" -A "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36" http://example.com/; done
@rahul286
rahul286 / newrelic-delete.php
Last active October 2, 2015 11:11
New-Relic - Deleting non-reporting servers
<?php
/**
* Usage: insert $API_KEY and run script using php cli
**/
//New Relic API KEY
// can be found in Account Settings >> Data Sharing OR https://rpm.newrelic.com/api/explore/ OR
// doc - https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/rest-api-key
@rahul286
rahul286 / ning-json-fix.sh
Last active October 12, 2015 22:13
Fixing invalid json files created by Ning Archiver tool
## MAC OSX users, please note that following codes won't work with BSD based sed implementation.
## You can get GNU Mac- `brew install gnu-sed --default-names`
sed -i -e '1s/^.//' ning*
sed -i -e '$s/.$//' ning*
sed -i -e 's/}{/},{/g' ning*
sed -i -e 's/}]{/},{/g' ning*
## extra: to verify if files are valid JSON filesmm run jsonlint
## To install `npm install jsonlint -g`
@rahul286
rahul286 / wp-diff.sh
Created August 22, 2015 12:20
Compare wordpress core file integrity
## change to site
cd /var/www/example.com/
## download wordpress
git clone https://github.com/wordpress/wordpress
## go to wordpress dir
cd wordpress
## switch to correct wordpress version to htdocs
@rahul286
rahul286 / nginx-plus-install.sh
Created June 11, 2015 06:25
nginx-plus installation
mkdir /etc/ssl/nginx
wget -P /etc/ssl/nginx/ https://cs.nginx.com/static/files/CA.crt
## move nginx-repo.crt to /etc/ssl/nginx/nginx-repo.crt
## move nginx-repo.key to /etc/ssl/nginx/nginx-repo.key
wget http://nginx.org/keys/nginx_signing.key
apt-key add nginx_signing.key
apt-get install apt-transport-https libgnutls26 libcurl3-gnutls
printf "deb https://plus-pkgs.nginx.com/ubuntu `lsb_release -cs` nginx-plus\n" >/etc/apt/sources.list.d/nginx-plus.list
@rahul286
rahul286 / wpcommon.conf
Created April 25, 2015 15:20
EDD downloads security with EasyEngine
# For more details, refer - https://easydigitaldownloads.com/support/topic/download-files-not-protected-nginx-under-easyengine/
# NOT tested (yet)
location /wp-content/uploads/ {
location ~ ^/wp-content/uploads/edd/(.*?)\.zip$ {
rewrite / permanent;
}
location ~ \.php$ {
#Prevent Direct Access Of PHP Files From Web Browsers
@rahul286
rahul286 / nginx-pagespeed.conf
Last active January 10, 2023 18:28
nginx + pagespeed downstream caching example
#source: http://www.jefftk.com/2014-01-03--nginx.conf
# for debugging with valgrind
#daemon off;
#master_process off;
#user nobody;
worker_processes 1;
worker_rlimit_core 500M;
@rahul286
rahul286 / wild.sh
Created April 13, 2015 06:28
wildcard DNS record checker
#!/bin/sh
# Usage: bash wild.sh <example.com>
# Repalce <example.com> with domain you want to check
# Random word loginc from http://www.unixcl.com/2008/05/generate-random-words-in-linux.html
WORDFILE="/usr/share/dict/words"
NUMWORDS=10
#Number of lines in $WORDFILE