- 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
<?php | |
file_put_contents( 'progress.txt', '' ); | |
$targetFile = fopen( 'testfile.iso', 'w' ); | |
$ch = curl_init( 'http://ftp.free.org/mirrors/releases.ubuntu-fr.org/11.04/ubuntu-11.04-desktop-i386-fr.iso' ); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt( $ch, CURLOPT_NOPROGRESS, false ); | |
curl_setopt( $ch, CURLOPT_PROGRESSFUNCTION, 'progressCallback' ); | |
curl_setopt( $ch, CURLOPT_FILE, $targetFile ); |
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
function alertTerminal(){ | |
console.log("\007"); | |
} |
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
@echo off | |
setlocal EnableDelayedExpansion | |
set char=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 | |
set count=0 | |
set salt=0 | |
echo The maximum RC4 key length is 128 bits. | |
echo Default KEY length is 16 characters. |
Open $ vim /etc/default/grub
then add elevator=noop
next to GRUB_CMDLINE_LINUX_DEFAULT
. Run $ update-grub
and $ cat /sys/block/sda/queue/scheduler
to be sure that noop is being used:
$ vim /etc/default/grub
$ update-grub
$ cat /sys/block/sda/queue/scheduler
[noop] deadline cfq
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 | |
# No username or passwords in this script, you should use mysql_config_editor | |
# to store it securely. The login-path in this script is set to "local-backup" so when you create | |
# your .mylogin.cnf with the mysql-config-editor make sure it is set the same | |
# See http://dev.mysql.com/doc/refman/5.6/en/mysql-config-editor.html | |
# An example to create your config for a mysql user "backup": | |
# shell> sudo mysql_config_editor set --login-path=local-backup --host=localhost --user=backup --password | |
# The backup user in the mysql server needs these privileges: SELECT, RELOAD, SHOW DATABASES, REPLICATION CLIENT |
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
$("#search-txt").autocomplete({ | |
source: function (req, responseFn) { | |
$.ajax({ | |
url: "/search.json", | |
dataType: "json", | |
success: function(data) { | |
var re = $.ui.autocomplete.escapeRegex(req.term); | |
var matcher = new RegExp( "^" + re, "i" ); |
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 | |
/** | |
* Case-insensitive in_array() wrapper. | |
* | |
* @param mixed $needle Value to seek. | |
* @param array $haystack Array to seek in. | |
* | |
* @return bool | |
*/ |
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 | |
# install the smartctl package first! (apt-get install smartctl) | |
if sudo true | |
then | |
true | |
else | |
echo 'Root privileges required' |
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
#!/usr/bin/env python | |
# GPGIt : Automatically GPG-encrypt incoming email | |
# Aeris <[email protected]> | |
# Licensed under AGPLv3 or later | |
import email | |
import sys, os | |
import re | |
from pyme.core import Data, Context | |
from email.mime.base import MIMEBase |
OlderNewer