Skip to content

Instantly share code, notes, and snippets.

View calvez's full-sized avatar
🏠
Working from home

calvez calvez

🏠
Working from home
  • Budapest, Hungary
View GitHub Profile
@calvez
calvez / gist:053c6aa865f2c49cfbf7a20efad13edb
Created July 6, 2016 03:50 — forked from mattfarina/gist:751854
Make Drupal 7 search button an image button.
/**
* Implements hook_form_alter().
*
* Courtesy of JohnAlbin
*/
function THEMENAME_form_search_block_form_alter(&$form, &$form_state) {
$form['actions']['submit']['#type'] = 'image_button';
$form['actions']['submit']['#src'] = drupal_get_path('theme', 'THEMENAME') . '/images/button-search.png';
}
@calvez
calvez / functions.php
Last active July 26, 2016 09:09
Filter posts by category on frontpage wordpress 2.9+
// =========================================
// = Filter posts by category on frontpage =
// =========================================
function exclude_category($query) {
if ( $query->is_home() ) {
$query->set('cat', '-6');
}
return $query;
@calvez
calvez / find-lrage-files.md
Created August 9, 2016 08:45
How Do I Find The Largest Top 10 Files and Directories On a Linux / UNIX / BSD?
@calvez
calvez / .htaccess
Last active November 8, 2022 22:57
Hardening Wordpress sites
# Block the include-only files.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^wp-admin/includes/ - [F,L]
RewriteRule !^wp-includes/ - [S=3]
RewriteRule ^wp-includes/[^/]+\.php$ - [F,L]
RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F,L]
RewriteRule ^wp-includes/theme-compat/ - [F,L]
</IfModule>
@calvez
calvez / timestamp.sh
Created October 7, 2016 15:35
bash timestamp and/or date
#!/bin/bash
# Define a timestamp function
timestamp() {
date +"%T"
}
# do something...
timestamp # print timestamp
# do something else...
@calvez
calvez / convert id_rsa to pem
Created October 18, 2016 14:53 — forked from mingfang/convert id_rsa to pem
Convert id_rsa to pem file
openssl rsa -in ~/.ssh/id_rsa -outform pem > id_rsa.pem
chmod 700 id_rsa.pem
@calvez
calvez / fail2ban.sh
Created October 19, 2016 15:14
fail2ban report ips
sudo awk '($(NF-1) = /Ban/){print $NF}' /var/log/fail2ban.log | sort | uniq -c | sort -n
<?php
/**
* The Header for our theme.
*
* Displays all of the <head> section and everything up till <div id="content">
*
* @package activello
*/
?><!doctype html>
<!--[if !IE]>
@calvez
calvez / LICENCE SUBLIME TEXT
Created November 27, 2016 18:14
Sublime Text 3 Serial key build is 3103
—– BEGIN LICENSE —–
Michael Barnes
Single User License
EA7E-821385
8A353C41 872A0D5C DF9B2950 AFF6F667
C458EA6D 8EA3C286 98D1D650 131A97AB
AA919AEC EF20E143 B361B1E7 4C8B7F04
B085E65E 2F5F5360 8489D422 FB8FC1AA
93F6323C FD7F7544 3F39C318 D95E6480
FCCC7561 8A4A1741 68FA4223 ADCEDE07
@calvez
calvez / wp_update.sh
Created December 4, 2016 21:23 — forked from MiteshShah/wp_update.sh
Update Multiple WordPress
#!/bin/bash
# Define Variables
WEB_ROOT=/var/www
WEB_ROOT_PREFIX=htdocs
WEB_ROOT_GROUP=www-data
WP_UPDATE_LOGS=/var/log/setup/wp-update.log
# Capture Errors
function OwnError() {