Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Step 0: Failsafe

First things first, make sure you have a backup of all of your files, and preform a system backup if possible.


Step 1: Clearing Out Obvious Processes

Pretty straight forward, just Ctrl + Alt + Del and open the process manager. End any tasks where the name of the process sounds fishy.

@ProjectCleverWeb
ProjectCleverWeb / insta-lamp-server.sh
Created June 23, 2015 20:32
Instant LAMP Server
# Instant Install of PHP, Apache, and MySQL for a fresh Ubuntu VPS (tested for 15.04 on 2015-06-23)
# NOTE: Enables MOST of PHP's extentions
sudo apt-get update
sudo apt-get upgrade
sudo apt-get -y install apache2 mysql-server php5 libapache2-mod-php5 libapache2-mod-auth-mysql php5-mysql php5-cgi php5-cli php5-common php5-curl php5-dbg php5-dev php5-gd php5-gmp php5-json php5-ldap php5-mysql php5-odbc php5-pgsql php5-pspell php5-readline php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl libphp5-embed php5-adodb php5-enchant php5-exactimage php5-fpm php5-gdcm php5-gearman php5-geoip php5-gnupg php5-imagick php5-imap php5-interbase php5-intl php5-lasso php5-librdf php5-mapscript php5-mcrypt php5-memcache php5-memcached php5-midgard2 php5-ming php5-mongo php5-msgpack php5-oauth php5-pinba php5-ps php5-radius php5-redis php5-remctl php5-rrd php5-sasl php5-stomp php5-svn php5-sybase php5-tokyo-tyrant php5-vtkgdcm php5-xcache php5-xdebug php5-xhprof
@ProjectCleverWeb
ProjectCleverWeb / rgb-contrast.php
Created July 19, 2016 19:28
Simple and very accurate function to check the contrast of 2 RGB colors. (uses YIQ weights)
/**
* Measures the visual contrast of 2 RGB colors.
*
* NOTE: most colors do not have a 100% contrasting opposite, but all colors
* do have a contrasting opposite that is at least 50%.
*
* @param array $rgb1 The first color, array where offsets 'r', 'g', & 'b' contain their respective values.
* @param array $rgb2 The second color, array where offsets 'r', 'g', & 'b' contain their respective values.
* @return float The visual contrast as a percentage (e.g. 12.345)
*/
<?php
// Original (good until you get to the higher numbers -- RAM and Recursion limits)
$primes = array(1);
$numbers = range(2, 10000);
function sieve(array &$primes, &$numbers) {
if (empty($numbers)) {
return;
@ProjectCleverWeb
ProjectCleverWeb / # yarn - 2020-03-10_18-39-00.txt
Created March 10, 2020 22:53
yarn on macOS 10.15.2 - Homebrew build logs
Homebrew build logs for yarn on macOS 10.15.2
Build date: 2020-03-10 18:39:00
<?php
/**
* Takes an input background color and tells you if you should use a white or black for the text color
*/
$input_color = '49DCBB';
$red = base_convert(substr($input_color, 0, 2), 16, 10);
$green = base_convert(substr($input_color, 2, 2), 16, 10);
$blue = base_convert(substr($input_color, 4, 2), 16, 10);
@ProjectCleverWeb
ProjectCleverWeb / centered.md
Last active September 20, 2023 09:46
Example of how to do centered text and images in Githb Flavored Markdown
/**
* MySQL Multi-Line Insert
* =======================
* See: https://gist.github.com/ProjectCleverWeb/d2362b082af1d7054ebfd464f202ec1b
*
* Notes:
* - I used a output buffer variable since in most languages variables are
* significantly faster than function calls and in this case the syntax for
* using a variable was both shorter and easier to read.
* - Table & column names are quoted to help improve compatibility, but in most