- L1 cache reference
0.5 ns
- Branch mispredict
5 ns
(on a bad CPU architecture you're pretty much screwed) - L2 cache reference
7 ns
- Mutex lock/unlock
25 ns
- Main memory reference
100 ns
- Compress 1K bytes with Zippy
3,000 ns
- Send 2K bytes over 1 Gbps network
20,000 ns
- Read 1 MB sequentially from memory
250,000 ns
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
configure | |
# Configure Firewall | |
set firewall ipv6-name IPV6WAN_IN description 'IPV6WAN to internal' | |
set firewall ipv6-name IPV6WAN_IN default-action drop | |
set firewall ipv6-name IPV6WAN_IN rule 10 action accept | |
set firewall ipv6-name IPV6WAN_IN rule 10 state established enable | |
set firewall ipv6-name IPV6WAN_IN rule 10 state related enable | |
set firewall ipv6-name IPV6WAN_IN rule 10 log disable |
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
server { | |
listen 443; | |
server_name pve.mydomain.com; | |
ssl on; | |
ssl_certificate /etc/nginx/ssl/ssl.crt; | |
ssl_certificate_key /etc/nginx/ssl/ssl.key; | |
proxy_redirect off; | |
location / { |
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
upstream gitlab { | |
server 172.17.42.1:10080 fail_timeout=0; | |
} | |
# let gitlab deal with the redirection | |
server { | |
listen 80; | |
server_name git.example.com; | |
server_tokens off; | |
root /dev/null; |
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 | |
/** | |
* Filtering a array by its keys using a callback. | |
* | |
* @param $array array The array to filter | |
* @param $callback Callback The filter callback, that will get the key as first argument. | |
* | |
* @return array The remaining key => value combinations from $array. | |
*/ |
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
#!/bin/bash | |
### BEGIN INIT INFO | |
# Provides: rtorrent | |
# Required-Start: $local_fs $remote_fs $network $syslog | |
# Required-Stop: $local_fs $remote_fs $network $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Start/stop rtorrent daemon | |
### END INIT INFO |
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
# to generate your dhparam.pem file, run in the terminal | |
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
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
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
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 | |
class base58 | |
{ | |
static public $alphabet = "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"; | |
public static function encode($int) { | |
$base58_string = ""; | |
$base = strlen(self::$alphabet); | |
while($int >= $base) { |
NewerOlder