Last.fm Records with Absynthe theme (latest version breaks it)
Hey everyone.
So my Last.fm records plugin that is built-in or implemented with this amazing theme broke after I upgraded it, so I checked and it seems the whole plugin is now using jQuery. I have had to do some modifications to make it work, I hope this helps.
FIrst, you need to add this in your wp-content/themes/absynthe/header.php right after <![endif]-->.
<script type='text/javascript' src='/wp-includes/js/jquery/jquery.js'></script>
After that, you need to edit wp-content/themes/absynthe/footer.php and replace this:
if (function_exists('lastfmrecords_display')) {
lastfmrecords_display();
}
?>
By this:
<div id="lastfmrecords"></div>
Once you’ve made those changes, go to Settings > Last.fm Records, make sure that the CSS is disabled else it won’t look pretty and make sure the placeholder is set to “lastfmrecords”.
Enjoy
I will let the developer of this theme know so he can fix this too.
Small application for disabling mod_security for specific domains on cPanel server
Alright, I’m lazy so I always make a script/utility for anything and everything. Another fine piece of lazygineering.
This little script disables mod_security on specific domains that you pick, mod_security2 does not allow disabling it from .htaccess and it’s pretty annoying to do the same work all over and over again, why not make it one line only.
Introducing, disable_modsec — Enjoy lazy cPanel server admins.
#!/usr/bin/perl
use strict;
use lib qw(/usr/local/cpanel);
use Cpanel::AcctUtils::DomainOwner;
if ($ARGV[0])
{
# Get username
my $username = Cpanel::AcctUtils::DomainOwner::getdomainowner($ARGV[0]);
my $domain = $ARGV[0];
# Create directory for config
system ('mkdir -p /usr/local/apache/conf/userdata/std/2/'.$username.'/'.$domain);
# Create config file
open (CONFIG, ">>/usr/local/apache/conf/userdata/std/2/".$username.'/'.$domain.'/modsec.conf');
print CONFIG "
close CONFIG;
# Enable vHost includes
system ('/scripts/ensure_vhost_includes --user='.$username);
} else {
print("Usage: disable_modsec [domain]\n");
}
Little “makeover” to this blog
K2 was getting boring and I have nothing to do on a Saturday evening.
This blog looks much better thanks to the awesome Absynthe theme by Chris Wallace who makes awesome wordpress themes (there’s some free SEO for you
Also, he had implemented Last.FM & Twitter integration that’s very prettttttty. Thanks!
Useful little bit of code – List all domains on cPanel server
Need to list all domains on the server (no subdomains, etc)?
Here’s the magical code:
cat /etc/userdomains | awk -F ':' '{ print $1 }' | sed 's/.*\.\(.*\.\)/\1/' | sort -u
Citrix XenServer + VLAN Trunking setup (Cisco switch)
I have been involved with recent Citrix virtualization setups with our company and I have not see any clear tutorials on how to work with VLAN trunking and Citrix XenServer. The advantage of using this is being able to use VLANs to separate your network but at the same time being able to do live migrations without losing connectivity. These articles will be separated in a couple of parts, this part is mainly focused on setting up the trunking on the switch itself. The trunking allows the XenServer to have, technically, presence on every VLAN, therefore when migrating servers, the internet connection does not stop working because the VLAN on the target server is different. Hope it’s clear.
First of all, telnet to your switch, these instructions are for Cisco switches, that’s all I ever worked with anyways, heh. All those instructions use IOS.
First of all you need to pick the port that you’ll be working on, make sure you have physical access to the server you’re going to be working with, I’m not responsible for some settings going poof and you having to drive down to your data center to fix the issue.
So, the interface that I will be working with is FastEthernet1/8 — Enter configuration mode and go to the port
conf t
int FastEthernet1/8
Enable trunking and 801q capsulation
switchport mode trunk
switchport trunk encapsulation dot1Q
switchport trunk native vlan 1000
Make sure the native VLAN is the same VLAN that the network was running on previously, read more information why here:
To establish 802.1q trunking both sides must be in the same native VLAN this is because the encapsulation is not setup yet and the 2 switches must talk over an un-encapsulated link (native VLAN) to setup the encapsulation in the first place. Why this works is because neither side is encapsulating packets with its VLAN tag since they are both talking over their native VLAN, basicly neither side knows that the other side is in a different VLAN to begin with and they are just sending unencapsulated packets back and forth. So if you set a port on the core switch as native vlan 5 for example and connected a dumb switch to it vlan 5 traffic would go un encapsulated to the dumb switch and it can understand it but it will put it in its VLAN 1 ports there is no actual trunking going on. No 802.1q or ISL!
juniperr @ DevShed
cPanel humor: Uninstalling cPanel
It’s always been known that once you install cPanel, you cannot uninstall it, the only way to get rid of it reinstall the server completely. However, I was doing some work on a server and ran into this file:
/usr/local/cpanel/uninstall
And the content:
#!/bin/sh
# Uninstall script for Cpanel
rm -f "/usr/local/cpanel/uninstall"
#### END OF UNINSTALL
echo "Cpanel has been uninstalled."
Nice to know that developers still have a sense of humor. cPanel’s developers are always known to be down to earth guys and I can assure you that’s true! (not if that little bit of code in a production program didn’t prove it!
)
HyperVM login error: not_in_list_of_allowed_ip
We had a client who was not able to login to his HyperVM control panel to make modifications to his virtual private server, the error he was getting was the following:
Alert: not_in_list_of_allowed_ip [xx.xx.xx.xx]
The IP of the client is located at the “xx.xx.xx.xx” part, this is easily fixed by clearing the block list on the server with this command (on the main node), you must replace the user.vm part by the username of the client at HyperVM (most of the time, something.vm).
/script/clearallowedblockedip --class=client --name=user.vm
It should return something like the following:
AllowedIp Sucessfully cleared for client:user.vm
Afterwards, the client/you should be able to login with no problem at all.
Horde broken or not working correctly on cPanel server
Simple, short & sweet post, this should easily fix any problems you’re having
/usr/local/cpanel/bin/update-horde --force
Also, this might be useful to run hourly, I leave this on our servers “just in case”.
(mysqlcheck --auto-repair eximstats ; mysqlcheck --auto-repair horde) >/dev/null 2>/dev/null
/tmp clean-up script modification, sessions dying with PHP
It seems there there was a little flaw in the script that I wrote a while ago, any PHP sessions on the server will timeout/die after 1 hour if you run that as an hourly cronjob, I have made a small modification to the script.
The only small modification is that now, it deletes all sess_* files that have not been accessed for 5 days therefore are probably just sitting there and never going to be used again, the rest remain deleted because it’s failed uploads/etc that will never be used again.
#!/bin/bash
# Change directory to /tmp
cd /tmp
# Clean up trash left by Gallery2
ls | grep '[0-9].inc*' | xargs rm -fv
# Clean up PHP temp. session files
find /tmp -atime +5 -name 'sess_*' -print | xargs rm -fv
# Clean up dead vBulletin uploads
ls | grep 'vbupload*' | xargs rm -fv
# Clean up failed php uploads
ls | grep 'php*' | xargs rm -fv
# Clean up failed ImageMagick conversions.
ls | grep 'magick*' | xargs rm -fv
Thanks!
