Skip to content

Instantly share code, notes, and snippets.

View rahul286's full-sized avatar
😷

Rahul Bansal rahul286

😷
View GitHub Profile
<?php
//* Using the Gravity Forms editor, be sure to check "Allow field to be populated dynamically under Advanced Options
//* You will need to set the Field Parameter Name value to work with the filter as follows: gform_field_value_$parameter_name
//* Dynamically populate first name for logged in users
add_filter('gform_field_value_first_name', 'populate_first_name');
function populate_first_name($value){
global $current_user;
get_currentuserinfo();
return $current_user->user_firstname;
@rahul286
rahul286 / jail.local
Created May 1, 2014 10:21
fail2ban ignoreip for cloudflare
ignoreip = 127.0.0.0/8 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 199.27.128.0/21 173.245.48.0/20 103.21.244.0/22 103.22.200.0/22 103.31.4.0/22 141.101.64.0/18 108.162.192.0/18 190.93.240.0/20 188.114.96.0/20 197.234.240.0/22 198.41.128.0/17 162.158.0.0/15 104.16.0.0/12 2400:cb00::/32 2606:4700::/32 2803:f800::/32 2405:b500::/32 2405:8100::/32

Keybase proof

I hereby claim:

  • I am rahul286 on github.
  • I am rahul286 (https://keybase.io/rahul286) on keybase.
  • I have a public key whose fingerprint is F3EE 65A9 C240 F22C D088 39EA 35F8 2EAE 1FE9 2BA3

To claim this, I am signing this object:

Ghost is an open source platform for blogging founded by John O'Nolan and Hannah Wolfe. It's a node.js application and therefore works great in conjunction with nginx. This guide will will help you create a high performance nginx virtual host configuration for Ghost.

"Don't use #nodejs for static content" - @trevnorris. If #nginx isn't sitting in front of your node server, you're probably doing it wrong.

— Bryan Hughes (@nebrius) August 30, 2014
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>

The node.js application runs on a port on your server. We can configure nginx to proxy to this port and also cache so that we don't need to rely on express, the default n

@rahul286
rahul286 / notes.md
Last active August 29, 2015 14:13
Gitbook customization
@rahul286
rahul286 / hook-debug.php
Last active August 29, 2015 14:16
git-webhook in php
<?php
// array - repo names and local filesystem path and branch
$repos = array(
'bad-plugin' => array (
'branch' => 'master',
'localpath' => '/var/www/example.com/htdocs/wp-content/plugins/bad-plugin'
)
);
rt_write_log("Hello at " . date("D M j G:i:s T Y") );
@rahul286
rahul286 / wp-svn-deploy.sh
Created March 19, 2015 10:08
WordPress SVN Plugin Deployment Script
##### YOU CAN STOP EDITING HERE #####
CURRENTDIR=`pwd`
# git config
GITPATH="$CURRENTDIR/" # this file should be in the base of your git repository
# svn config
SVNPATH="/tmp/$PLUGINSLUG" # path to a temp SVN repo. No trailing slash required and don't add trunk.
SVNURL="https://plugins.svn.wordpress.org/$PLUGINSLUG/" # Remote SVN repo on wordpress.org, with no trailing slash
@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
@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 / 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