Skip to content

Instantly share code, notes, and snippets.

View rahul286's full-sized avatar
😷

Rahul Bansal rahul286

😷
View GitHub Profile
@rahul286
rahul286 / wp-cron.sh
Last active May 29, 2016 08:12 — forked from chmac/wp-cron.sh
#!/bin/bash
# Script inspired by https://gist.github.com/1025598
# Script inspired by https://gist.github.com/chmac/2575823
#### WARNING ####
#### Please be careful with this script. The use of eval $(find) is dangerous.
#### If a user can upload a file called wp-config.php anywhere onto your site,
#### they can probably execute arbitrary commands via this script.
#### You have been warned. GPL, no warranty.
@rahul286
rahul286 / ocp.php
Created July 21, 2013 19:57 — forked from ck-on/ocp.php
<?php
/*
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)
Author: _ck_ (with contributions by GK, stasilok)
Version: 0.1.6
Free for any kind of use or modification, I am not responsible for anything, please share your improvements
* revision history
0.1.6 2013-04-12 moved meta to footer so graphs can be higher and reduce clutter
0.1.5 2013-04-12 added graphs to visualize cache state, please report any browser/style bugs
#!/bin/bash
set -o errexit
# Author: David Underhill
# Script to permanently delete files/folders from your git repository. To use
# it, cd to your repository's root and then run the script with a list of paths
# you want to delete, e.g., git-delete-history path1 path2
#
# retrieved from: http://dound.com/2009/04/git-forever-remove-files-or-folders-from-history/
#
<?php
/*
Usage:
$frag = new CWS_Fragment_Cache( 'unique-key', 3600 ); // Second param is TTL
if ( !$frag->output() ) { // NOTE, testing for a return of false
functions_that_do_stuff_live();
these_should_echo();
// IMPORTANT
$frag->store();
// YOU CANNOT FORGET THIS. If you do, the site will break.
#!/bin/bash
####
# Split MySQL dump SQL file into one file per table
# based on http://blog.tty.nl/2011/12/28/splitting-a-database-dump
####
if [ $# -lt 1 ] ; then
echo "USAGE: bash mysql_splitdump.sh DUMP_FILE [TABLE]"
exit
@rahul286
rahul286 / moved.md
Last active August 30, 2020 20:40
woo-commerce fastcgi-cache session-conflict solution (attempt)
<?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 / 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
@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: