This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function array_size($arr) { | |
$byte = 0; | |
foreach ($arr as $key => $val) { | |
$byte += is_array($val) ? array_size($val) : mb_strlen($val); | |
} | |
$kb = number_format($byte / 1024, 4); | |
$mb = number_format($byte / 1048576, 4); | |
$gb = number_format($byte / 1073741824, 4); | |
$result = array('Bytes: ' => $byte, 'Kilobytes: ' => $kb, 'Megabytes: ' => $mb, 'Gigabytes: ' => $gb); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script> | |
<style> | |
.game {display:none;} | |
.active-g {display:block} | |
.checked {color:red;} | |
</style> | |
</head> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function get_highlight($str) { | |
$colors = array('#ccddee', '#ffdddd', '#ddccee', | |
'#ddeecc', '#eeccdd', '#cceedd', | |
'#eeddcc', '#ddddff', '#ddffdd'); | |
shuffle($colors); | |
static $prev_color = ''; | |
static $arr = array(); | |
if (!in_array($str, $arr)) { | |
$arr[] = $str; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script> | |
</head> | |
<body> | |
<!-- Popup --> | |
<div id="overlay" style="display:none; position: fixed; width: 100%; height: 100%; background-color: black; z-index:1101; opacity:0.7; filter: alpha(opacity=70); top:0; left:0;"></div> | |
<div id="popup" style="display:none; z-index:1101; position: fixed; width:100%; max-width:700px; height:100%; max-height:572px; top: 50%; left: 50%; margin-top: -286px; margin-left: -350px;"> | |
<a href="#" style="color:#fff; float:right; font-weight:bold;" onClick="setCookie()">Close <span class="glyphicon glyphicon-remove"></span></a> | |
<div style="width:700px; height:572px; background-color:#000;"></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function rgb_gen($rgb, $percent) { | |
$cleaned_percent = preg_replace("/\..*|%/", "", $percent); | |
$rgb_increment = 100 - $cleaned_percent; | |
$rgb_arr = explode(',', $rgb); | |
$rgb_arr[0] + $rgb_increment <= 255 ? $rgb_arr[0]+=$rgb_increment : $rgb_arr[0] = 255; | |
$rgb_arr[1] + $rgb_increment <= 255 ? $rgb_arr[1]+=$rgb_increment : $rgb_arr[1] = 255; | |
$rgb_arr[2] + $rgb_increment <= 255 ? $rgb_arr[2]+=$rgb_increment : $rgb_arr[2] = 255; | |
$new_rgb = implode(',', $rgb_arr); | |
return $new_rgb; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I will consider that you have three servers. First one with apache, second one with nginx server and third with bind. | |
1: Go to bind server (/etc/bind/zones/) and setup new A records to site that we will run. | |
- nginx5 IN A 192.168.0.1 | |
- apache5 IN A 192.168.0.2 | |
2: Set vhost with new site for port 8080 (/etc/apache2/sites-available/) | |
<VirtualHost *:8080> | |
ServerName apache5.mysite.com | |
ServerAdmin webmaster@localhost |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The previous answers were accurate, but perhaps too terse. I will try to add some examples. | |
First of all, the word "proxy" describes someone or something acting on behalf of someone else. | |
In the computer realm, we are talking about one server acting on the behalf of another computer. | |
For the purposes of accessibility, I will limit my discussion to web proxies - however, the idea of a proxy is not limited to web sites. | |
FORWARD proxy | |
Most discussion of web proxies refers to the type of proxy known as a "forward proxy." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$servername = "localhost"; | |
$username = "root"; | |
$password = "toor"; | |
$dbname = "test"; | |
// Create connection | |
$conn = new mysqli($servername, $username, $password, $dbname); | |
// Check connection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Installation on server: | |
sudo apt-get update | |
sudo apt-get install snmpd | |
sudo vim /etc/snmp/snmpd.conf | |
------------------ | |
# Listen for connections from the local system only | |
#agentAddress udp:127.0.0.1:161 | |
# Listen for connections on all interfaces (both IPv4 *and* IPv6) | |
agentAddress udp:161,udp6:[::1]:161 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | |
function pagination($url, $rowscount, $per_page) { | |
$ci = & get_instance(); | |
$ci->load->library('pagination'); | |
$config = array(); | |
$config["base_url"] = base_url($url); | |
$config["total_rows"] = $rowscount; | |
$config["per_page"] = $per_page; |
OlderNewer