Install ImageMagick for image conversion:
brew install imagemagick
Install tesseract for OCR:
brew install tesseract --all-languages
Or install without --all-languages
and install them manually as needed.
# Build an inverted index for a full-text search engine with Redis. | |
# Copyright (C) 2009 Salvatore Sanfilippo. Under the BSD License. | |
# USAGE: | |
# | |
# ruby invertedindex.rb add somedir/*.c | |
# ruby invertedindex.rb add somedir/*.txt | |
# ruby search your query string | |
require 'rubygems' | |
require 'redis' |
# | |
# Powershell script for adding/removing/showing entries to the hosts file. | |
# | |
# Known limitations: | |
# - does not handle entries with comments afterwards ("<ip> <host> # comment") | |
# | |
$file = "C:\Windows\System32\drivers\etc\hosts" | |
function add-host([string]$filename, [string]$ip, [string]$hostname) { |
#include <event.h> | |
#include <evhttp.h> | |
#include <pthread.h> | |
#include <errno.h> | |
#include <string.h> | |
#include <fcntl.h> | |
#include <sys/socket.h> | |
#include <sys/types.h> | |
#include <netinet/in.h> | |
#include <iostream> |
; ----------------------------------------------------------------------------- | |
; main.asm - FASt Server - Main FASt Server entry point and loader. | |
; http://www.jamesladdcode.com/ | |
; | |
; ----------------------------------------------------------------------------- | |
; | |
.686 ; create 32 bit code | |
.model flat, stdcall ; 32 bit memory model | |
option casemap :none ; case sensitive |
#include <evhttp.h> | |
void process_request(struct evhttp_request *req, void *arg){ | |
struct evbuffer *buf = evbuffer_new(); | |
if (buf == NULL) return; | |
evbuffer_add_printf(buf, "Requested: %s\n", evhttp_request_uri(req)); | |
evhttp_send_reply(req, HTTP_OK, "OK", buf); | |
} | |
int main () { |
var data = "do shash'owania"; | |
var crypto = require('crypto'); | |
crypto.createHash('md5').update(data).digest("hex"); |
Install ImageMagick for image conversion:
brew install imagemagick
Install tesseract for OCR:
brew install tesseract --all-languages
Or install without --all-languages
and install them manually as needed.
worker_processes 1; | |
error_log logs/error.log; | |
events { | |
worker_connections 1024; | |
} |
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 |