Skip to content

Instantly share code, notes, and snippets.

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

Hans Kuijpers hans2103

🏠
Working from home
View GitHub Profile
@hans2103
hans2103 / statements.sql
Created January 29, 2015 13:29
SQL Tips & Tricks
SELECT *
FROM asdfg_posts
WHERE post_content LIKE '%href="wiki%';
SELECT *
FROM asdfg_posts
WHERE post_content LIKE '%href="/wiki%';
UPDATE asdfg_posts
SET post_content = replace(post_content, 'href="wiki', 'href="/wiki')
@hans2103
hans2103 / nginx.conf
Created January 30, 2015 13:23
nginx block
# Block semalt.com
if ($http_referer ~* "semalt\.com") {
return 444;
}
@hans2103
hans2103 / .htaccess
Created January 30, 2015 13:30
block semalt.com and other bad guys in .htaccess
SetEnvIfNoCase Referer buttons-for-website.com spammer=yes
SetEnvIfNoCase Referer semalt.com spammer=yes
Order allow,deny
Allow from all
Deny from env=spammer
@hans2103
hans2103 / .htaccess
Last active August 29, 2015 14:14
sitemap.xml redirect to Joomla! XMAP sitemap
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^sitemap.xml$ index.php?option=com_xmap&view=xml&tmpl=component&id=1 [L]
@hans2103
hans2103 / .htaccess-block-unwanted-crawlers
Created April 13, 2015 08:31
Block unwanted sites from crawling your site
SetEnvIfNoCase Referer buttons-for-website.com spammer=yes
SetEnvIfNoCase Referer semalt.com spammer=yes
Order allow,deny
Allow from all
Deny from env=spammer
@hans2103
hans2103 / replacePattern.php
Created June 4, 2015 13:45
Replace space by underscore in pattern
<?php
/**
* replace space by underscore in given pattern
* written by Github user @pjdevries
*
* run from command line
* $ php unspace-anchor-names.php name-input-file > name-output-file
*
*/
@hans2103
hans2103 / getMetaData.php
Created June 4, 2015 13:40
get Meta Description from websites
<?php
/**
* get Meta Tags from weblinks
*
* input for this script is data.txt
* data.txt contains weblinks. Every line a new weblink.
*
* use this php script from command line
* $ cat data.txt|while read LINE;do php ./getMetaTags.php $LINE>>output.csv
*
@hans2103
hans2103 / batch-response
Created July 1, 2015 13:03
CLI batch check response of weblinks
/kennisbank/item/php_sessies /kennisbank/item/Gebruik_van_PHP_sessies
/kennisbank/item/php_session_start /kennisbank/item/Gebruik_van_PHP_sessies
/kennisbank/item/php_sqlite /kennisbank/cat/PHP
/kennisbank/item/php_traagheid /kennisbank/item/Website_debuggen:_snelheidsproblemen_oplossen
/kennisbank/item/php_veiligheid /kennisbank/item/PHP_scripts_veiliger_maken
- left: origin
- right: redirect url
check if origin exists
@hans2103
hans2103 / cli
Created July 22, 2015 09:55
Command Line Interface :: useful commands
// convert filenames to lowercase
$ for i in $(find . -type f -name "*[A-Z]*");do mv $i $(echo $i | tr A-Z a-z);done
@hans2103
hans2103 / joomla agenda.php
Last active August 29, 2015 14:26
Joomla! Category Blog - Agenda - template override
This Gist is to show you how I made the agenda view on http://oeteldonk.org/agenda
It's a template override on the com_content category blog view.
No third party extensions. Only Joomla! with a template override
COPY
components/com_content/views/category/tmpl/blog.xml
TO
templates/<your-template>/html/com_content/category/agenda.xml