Skip to content

Instantly share code, notes, and snippets.

View rahul286's full-sized avatar

Rahul Bansal rahul286

View GitHub Profile
@rahul286
rahul286 / rbenv-ubuntu.sh
Created April 7, 2015 07:15
rbenv ubuntu server cheatsheet
## ubuntu server with bash shell
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
## verify
type rbenv
@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 / 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 / notes.md
Last active August 29, 2015 14:13
Gitbook customization

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

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:

@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
@rahul286
rahul286 / monit
Created April 4, 2014 13:48
Monit
#!/bin/sh
# move this file to /etc/init.d/monit
### BEGIN INIT INFO
# Provides: monit
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Should-Start: $all
# Should-Stop: $all
<?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 / moved.md
Last active August 30, 2020 20:40
woo-commerce fastcgi-cache session-conflict solution (attempt)