Skip to content

Instantly share code, notes, and snippets.

View atomtigerzoo's full-sized avatar
🙃

HerrH atomtigerzoo

🙃
View GitHub Profile
@atomtigerzoo
atomtigerzoo / htpasswd-one-liner
Created January 16, 2015 16:46
Create .htpasswd for nginx without Apache
Replace USERNAME with your wished login-username and hit enter:
printf "USERNAME:`openssl passwd -apr1`\n" >> .htpasswd
@atomtigerzoo
atomtigerzoo / wordpress-split-content-at-more-shortcode.php
Last active August 30, 2023 05:41
Wordpress: split the_content into parts at more-shortcode
function atz_split_content_at_more(){
// Split the content
$content_parts = preg_split('/<span id="more-\d+"><\/span>/i', get_the_content());
// Grab first part of content and apply filters
$result['intro'] = apply_filters('the_content', array_shift($content_parts));;
// Content has a more part?
if(!empty($content_parts)):
$result['more'] = apply_filters('the_content', implode($content_parts));
@atomtigerzoo
atomtigerzoo / wordpress-hide-editor-on-pages.php
Last active December 29, 2020 17:25 — forked from ramseyp/hide-editor.php
Wordpress: Hide the editor on defined pages
/**
* Hide the main editor on specific pages
*/
define('EDITOR_HIDE_PAGE_TITLES', json_encode(array()));
define('EDITOR_HIDE_PAGE_TEMPLATES', json_encode(array('template-cars.php')));
/**
* Hide the main editor on defined pages
*
@atomtigerzoo
atomtigerzoo / wordpress-ctp-post_id-only.php
Created July 24, 2015 10:35
Wordpress: Custom post type with post_id-only in URLs
/**
* Replace 'mycustomname' with the actual custom type post
* name to fit your needs.
*
* !! Flush rewrite rules in Wordpress backend afterwards !!
*/
/**
* Create the CTP
@atomtigerzoo
atomtigerzoo / box-shadow-inset.css
Created November 17, 2015 10:07
CSS snippet with inset shadow examples for reference.
.inset-top{
box-shadow: inset 0 7px 9px -7px rgba(0,0,0,0.4);
}
.inset-left{
box-shadow: inset 7px 0 9px -7px rgba(0,0,0,0.4);
}
.inset-right{
box-shadow: inset -7px 0 9px -7px rgba(0,0,0,0.4);
}
.inset-bottom{
@atomtigerzoo
atomtigerzoo / virtualbox-with-shared-folder-for-node.md
Last active May 27, 2020 13:22
Virtualbox on Windows 7/Windows 10: Use npm/nodejs within a shared folder

Do not create a shared folder in settings/before - it will be created in step 3!

Enable symlinks for your VM

Open Windows PowerShell with adminstrator rights, enter:

$ VBoxManage setextradata YOURVMNAME VBoxInternal2/SharedFoldersEnableSymlinksCreate/YOURSHAREFOLDERNAME 1

Check if it got set:

$ VBoxManage getextradata YOURVMNAME enumerate

Create private networks with libvirt

I assume that you have a running debian wheezy host with libvirt and qemu/kvm installed. You need two guest VMs for this. The first guest will get the IP 192.168.100.2 and the second will get 192.168.100.100. All following commands must be run with sudo or under root.

Internal Network

We create a new network named internal with libvirt and use it with the IP

@atomtigerzoo
atomtigerzoo / relay-mail-to-external-smtp.md
Last active February 16, 2016 11:23
A simple way to send mails from a virtual server to another SMTP host for relaying/forwarding mails. Suitable for development - or just for kicks on a virtual server.

Relay mails to an external SMTP server

This shows you how to send mails from a - in this case virtual debian server inside VirtualBox - server to an external SMTP server. You can use your own server, Gmail or any other SMTP server you have access to.

This can then be used to send mail from PHP, Rails, Python, console or whatever you like.

The steps are for a debian wheezy server.

@atomtigerzoo
atomtigerzoo / wordpress-disable-yoast-seo-on-custom-post-type.php
Created March 31, 2016 12:39
Wordpress: Disable Yoast SEO on Custom Post Type
function my_remove_wp_seo_meta_box() {
remove_meta_box('wpseo_meta', YOUR_POST_TYPE_NAME_HERE, 'normal');
}
add_action('add_meta_boxes', 'my_remove_wp_seo_meta_box', 100);
How to install the VirtualBox Guest Additions in debian wheezy
$ su -
$ apt-get update && apt-get upgrade
Install needed packages
$ apt-get install build-essential module-assistant
Configure your system for building kernel modules
$ running m-a prepare