Skip to content

Instantly share code, notes, and snippets.

View logichub's full-sized avatar

Kashif Rafique logichub

View GitHub Profile
@pklaus
pklaus / analyseBreakinAttempts.sh
Last active September 20, 2022 10:32
A script that analyses the log files /var/log/auth.log* for illegal break-in attempts and writes all output to $logdir – Check http://blog.philippklaus.de/2010/02/analyse-illegal-ssh-login-attempts/
#!/bin/bash
# This script analyses the log files /var/log/auth.log* for
# illegal break-in attempts and writes all output to $logdir.
# <http://blog.philippklaus.de/2010/02/analyse-illegal-ssh-login-attempts/#comment-12211>
# inspired by <http://goo.gl/QMOhiU>
# and <http://filipivianna.blogspot.com/2009/10/checking-authlog-for-ssh-brute-force.html>
logbasedir=~/logs
@mikejolley
mikejolley / template-stock-report.php
Created December 5, 2011 20:18
WooCommerce - Stock Report. A template page snippet to (if you are logged in as admin) output a list of products/stock (which you are managing stock for) ready for printing.
<?php
/*
Template Name: Stock Report :)
*/
if (!is_user_logged_in() || !current_user_can('manage_options')) wp_die('This page is private.');
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@Rarst
Rarst / r-debug.php
Last active February 3, 2024 17:30
R Debug (set of dump helpers for debug)
<?php
/*
Plugin Name: R Debug
Description: Set of dump helpers for debug.
Author: Andrey "Rarst" Savchenko
Author URI: https://www.rarst.net/
License: MIT
*/
@mikejolley
mikejolley / gist:1860056
Created February 18, 2012 16:27
WooCommerce - Override billing fields
add_filter( 'woocommerce_billing_fields', 'custom_woocommerce_billing_fields' );
function custom_woocommerce_billing_fields( $fields ) {
// Over-ride a single label
$fields['billing_first_name']['label'] = 'Your label';
// Over-ride a single required value
$fields['billing_first_name']['required'] = false;
@zanematthew
zanematthew / Login.php
Created March 4, 2012 03:42
WordPress Login Form
<?php
/**
* Template for login form.
*
* Submission is handled via ajax, see @package zm-wordpress-helpers for
* server side code. See the function call in zm_register_login_submit()
* for form processing.
*
* @uses zm_register_login_submit()
* @uses wp_lostpassword_url()
@zanematthew
zanematthew / login.js
Created March 4, 2012 03:43
JavaScript used for the WordPress Ajax Login form
/**
* JavaScript file for loading the custom login form.
* Note we are using jQuery in "no conflict mode".
*/
jQuery(document).ready(function( $ ){
/**
* Set-up our default dialog box with the following
* parameters.
*/
@zanematthew
zanematthew / gist:1970585
Created March 4, 2012 03:46
WordPress Ajax Login -- Target Div snippet
<?php
/**
* Target div for login form and container for dialog.
*
* This could easily be hooked into wp_footer() or just pasted into footer.php
* We have out parent div which is the dom element that jQuery UI modal is
* being attached to. The child div is our target element for our ajax
* requested form.
*/
?>
@zanematthew
zanematthew / gist:1970587
Created March 4, 2012 03:47
WordPress Ajax Login -- Form Processor
<?php
/**
* To be used in AJAX submission, gets the $_POST data and logs the user in.
*
* @uses check_ajax_referer()
* @uses wp_signon()
* @uses is_wp_error()
*
* @todo move this to the abtract!
*/
@zanematthew
zanematthew / gist:1970589
Created March 4, 2012 03:48
WordPress Ajax Login -- Load Template
<?php
/**
* loads a template from a specificed path
*
* @package Ajax
*
* @uses load_template()
* @todo move to zm-ajax or something?
*/
function zm_load_template() {