Post by AskApache | Jun 06, 2014
The following is just a quick but detailed reference of some of the commands I used to successfully uninstall cpanel permanently. This is for advanced users of the shell. If you run a single one of these commands without fully understanding it, you will probably kill your server, lose everything on it permanently, not have a website or email for weeks.. So backup everything. FIRST. You should also contact your hosting provider support - but be prepared for some MAJOR negativity.. cpanel makes things very easy for web-hosting companies, and you are less than a drop in their bucket.
Hacking bash cpanel linux whm
Apr 04, 2014
Just a quick reference to all those delicious unicode characters and how they render on the web‽‽
Web Development symbols Unicode
Feb 27, 2014
After many years of using any and all terminal emulators out there, from xterm to the Gnome terminal, to KDE Konsole to xfce4-terminal, lxterminal, vte, yakuake, rote, roxterm, sakura, terminator, and putty I finally I settled in for the long-haul with rxvt (rxvt-unicode).
My BOX: Slim -> Ratpoison -> URxvt -> Tmux -> Bash
Linux .Xdefaults .Xresources bash Gnome terminal GNU Screen ratpoison rxvt
Jan 30, 2014
Here's a nifty little idea I had that has some merit and is super easy. Separate favicons for separate areas of a site. Basically, I can't live without Firefox or Chrome and the way they use multiple tabs, having about 20-50 open at any one time.. But that makes it more difficult to find the right tab!
WordPress favicon PHP wordpress
Jan 28, 2014
While reading up on gethostbyaddr on PHP.net, I saw a nice idea for using fsockopen to connect over UDP port 53 to any Public DNS server, like Google DNS 8.8.8.8
, and sending the reverse addr lookup in oh about 100 bytes, then getting the response in oh about 150 bytes! All in less than a second. This is how/why to read/write data directly to the wire! This would be extremely valuable for use in things like my online header tool because it's faster than any other method. As usual, I went a bit overboard optimizing it to be lean and fast.
PHP DNS fsockopen gethostbyaddr Google networking OpenDNS PHP
Jan 08, 2014
Google's mod_pagespeed speeds up your site and reduces page load time. This open-source Apache HTTP server module automatically applies web performance best practices to pages, and associated assets (CSS, JavaScript, images), all transparently like a Squid Proxy.
With TMPFS you can dramatically improve the speed of mod_pagespeed and the webpages served by it. TMPFS will store/serve the optimized PageSpeed output directly from RAM!
Hosting Apache Google mod_pagespeed Nginx PageSpeed RAM tmpfs
Dec 17, 2013
PHP's fsockopen function lets you open an Internet or Unix domain socket connection for connecting to a resource, and is one of the most powerful functions available in the php language.
PHP fsockopen PHP socket strace udp Unix
Dec 16, 2013
Recently I had to setup a script to curl 10k urls, but it could only do 500 requests at any one time. In order to work under that limit, I created a function that returns the number of currently running processes on the machine in an extremely fast and efficient way, thus allowing the curl_multi requests to queu themselves such as GNU xargs.
PHP /proc clearstatcache Hard link PHP Process stat version_compare
Dec 05, 2013
Become a member of the Free Software Foundation today to help us reach our goal of $450,000 by January 31st.
Net Coreboot Free Software Foundation FSF GNU GNU/Linux Microsoft Windows
Oct 03, 2013
The collusion add-on for Firefox is super-legit. Just navigate to any website normally, then just click the little collusion icon in the status bar and a full detailed report pops up in a new tab describing all the sites that the current site shared your data with (shared as in connected).
View the full introduction to Collusion on mozilla.org, or view my Firefox Add-on Collection: AskApache Web Development (Advanced)
Software Add-on Collusion Cookie Firefox Mozilla Privacy
Sep 16, 2013
pdf.js is an HTML5 technology experiment that explores building a faithful and efficient Portable Document Format (PDF) renderer without native code assistance.
Javascript PDF pdf.js Portable Document Format
Jun 26, 2013
strace+ is an improved version of strace that collects stack traces associated with each system call. Since system calls require an expensive user-kernel context switch, they are often sources of performance bottlenecks. strace+ allows programmers to do more detailed system call profiling and determine, say, which call sites led to costly syscalls and thus have potential for optimization.
Linux gcc linux strace
Jun 05, 2013
If for some reason you need to use windows .bat batch file scripting to do some task, or you just want to learn the most universal batch programming language on Windows machines, you lucked out and found the AskApache example. My expertise is the shell, in this article the shell is Windows cmd.exe
. It has some pretty advanced windows shell usage, including pipes and redirection, but it's the modular linux-like coding approach that earns this script it's "advanced" title.
:SETPROMPT
set PROMPT=$_[%USERNAME%@%USERDOMAIN%]$S[$P]$_$M$G && EXIT /B
My favorite tool (and I've tried sooo many) for editing most Windows files and especially .bat files is the free and open-source Notepad++. Set that up and you will have a color-syntax-highlighted editor for Batch Scripting that works very very well.
Windows Batch File Batch Scripting Command Prompt Microsoft Windows
Jun 05, 2013
The machine itself is super super ultra-thin, wafer thin, very cool looking. It's crazy light, I was amazed how slick it looked when it arrived.
Huge amount of open-source hardware/chipsets/etc.. The first time I went through the dmesg I was smiling. 2 USB 3.0 ports, and they actually work as promised, very very fast transfer speeds to my USB 3.0 external SSD. Incredible speed, boot time is the fastest I've ever seen. Starts at $720, mine was $1,800
Products Arch Linux firmware/software GNU GNU / Linux Laptop linux Notebook
Jun 04, 2013
Clevo > Dell > Alienware. This is the best of the best. I've had mine for about a year now and have had 0 issues with it. It's fast, as in crazy unreal fast. It's not a huge server slice, but it acts like it. With 16GB of RAM, 8 cpus, SSD Raid, USB-3, and of course the graphics. Downside: about $3.5 - $6k
Products Alienware Dell Laptop M18XR2
May 07, 2013
A pure bash alternative to the python reflector, using curl, xargs, and sort for ranking Arch Linux mirrors.
Nice and simple. Short and sweet.
Shell Scripting ArchLinux awk bash cURL Python reflector sed shell-script
Apr 30, 2013
Want to redirect all links with any uppercase characters to lowercase using pure mod_rewrite within an .htaccess file? Sure why not! OR how to use RewriteMap and mod_speling for those with access to httpd.conf
Htaccess Htaccess httpd.conf mod_rewrite mod_speling RewriteCond RewriteRule
Apr 26, 2013
Bash Functions and Aliases for Traps, Kills, and Signals. Useful for translating signal numbers/signal names and getting more info about signals.
Shell Scripting bash kill trap
Apr 25, 2013
If you use Apache to auto-generate directory index listings of files/dirs, and you have a large number of files and directories in the root directory and/or slow IO speed, then generating the index could take Apache over a minute!
Shell Scripting Apache bash DirectoryIndex Htaccess IndexOptions rsync
Apr 06, 2013
This is a big update from the last time I looked into this, when I enumerated 57 Status Codes that Apache 2.x was capable of handling. This list contains 83 Status Codes recognized by Apache. I compiled the latest 2.4.4 Apache in order to view the actual codes sent by a live server.. very cool. You can read about the newest HTTP Status Codes in RFC 6585.
Net Apache cURL ErrorDocument Htaccess HTTP HTTP Headers Redirect Status Code
Apr 05, 2013
This is really useful for me because I work with dozens of different database servers. The first thing I do is run this command and paste it into the servers /etc/my.cnf
file. That way I will always know the original value and it just makes life much easier.
$ mysql -NBe 'SHOW VARIABLES' |sed 's,\t,^=,'|column -ts^|tr "\n" '@'|eval $(echo "sed '" "s,@\("{a..z}"\),\n\n\1,;" "'")|tr '@' "\n"|sed 's,^,# ,g'
MySQL /etc/my.cnf bash column eval MySQL MySQL Variables Command sed tr
Mar 28, 2013
As a security nut myself, and also a Linux admin, one of my biggest pet peeves is when I've taken the time and care to segment all the users on a server into separate home directories, and then some developer comes along, logs in as root, and changes the ownership of files. Other things can cause this, like Apache, PHP, Mutt, etc.. So I've always used a cron job that executes daily (and on demand) which automatically fixes all the permissions back to what they should be.
Linux bash chmod chown cron linux permissions shell
Mar 24, 2013
This is awesome. I was so fed up with trying to find a fail-proof, cross-platform way to find the mime type of an image using PHP that I wrote a quick function that utilizes the same technology as the exif_imagetype, getimagesize, and finfo functions do. Ahh the joys of low-level.
PHP file filetype images mime mimetype
Mar 20, 2013
If you are using Disqus on your site, you will see that annoyingly the default sort order for listing comments is 'best'.
I have implemented disqus on many sites and the number 1 request I get is to change the default sort order to newest.
There is no documentation or hints anywhere to solve this. So I solved it.
Javascript Disqus
Mar 13, 2013
Before
init-connect='SET NAMES utf8'
init_connect='SET CHARACTER SET=utf-8'
After
init_connect='SET collation_connection = utf8_general_ci,NAMES utf8'
MySQL init-connect my.cnf utf8
Mar 05, 2013
A simple review of the Plantronics Voyager Legend UC
- $199.95
Products Bluetooth gchat gotomeeting iphone skype wireless
Mar 05, 2013
Software keyboard linux Mac mouse Synergy Windows
Feb 22, 2013
So here's the basic idea: There are 2 sites, a development site and a live site. They are essentially mirrors of each other in terms of they have the same files. You need to disallow all search engine robots from indexing and crawling the development site, while allowing full crawling of your live site. Htaccess to the rescue!
Htaccess Htaccess RewriteRule robots.txt
Feb 14, 2013
Use mod_rewrite to enable phpMyAdmin links in the form: /dbname/table/
Htaccess phpMyAdmin RewriteRule
Feb 14, 2013
Request to https://www.askapache.com/cg/rewrite-test/?catch=caught&this=that
RewriteCond %{THE_REQUEST}
= GET /cgi-bin/php/pro/rewrite-test/?catch=caught&this=that HTTP/1.1
RewriteCond %{REQUEST_URI}
= /cg/rewrite-test/?catch=caught&this=that
RewriteCond %{QUERY_STRING}
= catch=caught&this=that
RewriteCond %{HTTP_HOST}
= www.askapache.com
RewriteCond %{HTTP_USER_AGENT}
= Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/20100101 Firefox/18.0
RewriteCond %{REMOTE_ADDR}
= 8.8.8.8
Htaccess
Feb 06, 2013
Ok, so on a site like this one, there is a tremendous amount of 'code' styled with CSS fonts in a pre, code, var, tt, samp, or kbd html tag. When using an programming tool like VIM to write code it is shown beautifully using your OS fonts. So then, how can we get that same font beauty to be there on the web? And, of course the solution must use best-practices (and preferably only use CSS and (X)HTML).
Also, text effects! --> View Solution
CSS font Google
Feb 01, 2013
Htaccess AddDescription Apache bash
Jan 31, 2013
Look at the text "askapache". That's pretty boring huh? It would be cool to have a nerdy textual representation of that for extra nerdy stuff like styling my /robots.txt file, email list signatures, forum sigs, etc. But who has time to create that by hand? If only there were an online tool to create it..
Bam.
Web Design
Jan 24, 2013
The Alexa Toolbar is a free search and navigation companion that accompanies you as you surf, providing useful information about the sites you visit without interrupting your Web browsing.
SEO Alexa rank SEO traffic
Jan 18, 2013
....
This is our world now... the world of the electron and the switch, the
beauty of the baud. We make use of a service already existing without paying
for what could be dirt-cheap if it wasn't run by profiteering gluttons, and
you call us criminals. We explore... and you call us criminals. We seek
after knowledge... and you call us criminals. We exist without skin color,
without nationality, without religious bias... and you call us criminals.
You build atomic bombs, you wage wars, you murder, cheat, and lie to us
and try to make us believe it's for our own good, yet we're the criminals.
....
Hacking Hacker Phrack
Jan 15, 2013
This is a brief explanation of what is needed for an awesome theme, well awesome from my perspective. This is good stuff, memorize it.
Web Development WordPress css web builder
Jan 03, 2013
The following is a transcript of a chat I had with a company called tektonic, and at that time I was looking for a cheap linux host to use for some redundancy/failover operations. I generally contact a new hosting company like this every few months.. I like to have options available in case of some kind of failure or network attack, so it's always a good idea to have a few ace linux servers in your back pocket.
If you've read any other articles on AskApache, you can see a certain obsession towards optimization, speed, and security -- so that is the purpose of the following questions.
Hosting HostGator Rackspace WiredTree
Jan 01, 2013
The proponents of this scheme have given it names such as "trusted computing" and "palladium". We call it "treacherous computing", because the effect is to make your computer obey companies instead of you. This was implemented in 2007 as part of Windows Vista; we expect Apple to do something similar. In this scheme, it is the manufacturer that keeps the secret code, but the FBI would have little trouble getting it.
Hacking
Dec 22, 2012
Orig published 2006. I had a CD-RW drive but being a computer security researcher I had no money for blank cd-recordables. What follows is how I managed to install various operating systems on my computer (1 hard drive) without having to burn to a CD the ISO and then boot from that.
And also:
==Phrack Inc.==
Volume 0x0b, Issue 0x3f, Phile #0x0a of 0x14
|=-----------------=[ Hacking Grub for fun and profit ]=-----------------=|
Linux bash GRUB iso linux OS Phrack USB
Dec 21, 2012
The story behind this plugin is sorta wack, but in a good way :). While doing tons of security research on permissions, authorization, access, etc.. for the Password Protection plugin (still being worked on), I needed to have unheard of debugging capabilities while working on the plugin on the various websites, webhosts, and test servers that I use to test in different environments. So I hacked together a bunch of php code that helped me debug, actually I pretty much went overkill and tried to get as much debugging info as programmatically possible, and it ended up being so much code that I took it out of my Password Protection code and made it its own plugin.
WordPress