July 25, 2016

nildb: a memory-efficient key/value database


NIL Key/Value database

NILDB is about the simplest key/value store you'll ever see, anywhere. It's written in plain vanilla C using only the standard string and FILE I/O functions, and should port to just about anything with a disk or something that acts like one.

NILDB is based on KISSDB, with significant update to reduce file size and improve efficiency, and also added the capability to delete entries.

It stores keys and values of fixed length in a stupid-simple file format based on fixed-size hash tables. If a hash collision occurrs, a link list is created and the entry is appended to the database. You can add, update, lookup and delete.

  • Tiny
  • Almost zero memory footprint
  • Very space-efficient on disk
  • Pretty respectably fast, especially given its simplicity
  • 64-bit file size limit is 2^64 bytes, and 2^32 offset limit between the same hashed entries.
  • Ports to anything with a C compiler and stdlib/stdio
  • Public domain
  • Works cross big-endian and little-endian system.
  • Fixed-size keys and values, must recreate and copy to change any init size parameter (Although can be adapted to varied value size easily)
  • No search for subsets of keys/values
  • No indexes
  • No transactions
  • No special recovery features if a database gets corrupted
  • No built-in thread-safety (guard it with a mutex in MT code)
  • No built-in caching of data (use filesystem cache)
Alternative key/value stores and embedded databases:
  • KISSDB The base of this project, uses multiple hash tables instead of just one
  • MDB uses mmap() and is very fast (not quite as tiny/simple/portable)

NILDB is in the public domain as according to the Creative Commons Public Domain Dedication.

June 23, 2016

text to speech and speech to text

text to speech:
 - Mary Text to Speech (Open source): http://mary.dfki.de/index.html
 - https://www.ivona.com/
 - http://neospeech.com/ (Better voice than ivona)

speech to text:

-  Kaldi open source: http://kaldi-asr.org/

-  Comparing Open-Source Speech Recognition Toolkits - Suendermann:  http://suendermann.com/su/pdf/oasis2014.pdf

-  Microsoft Bing Voie Recognition https://datamarket.azure.com/dataset/bing/speechrecognition, and code example: https://github.com/keedio/bing-speech-to-text-example

-  Google speech api

- AT&T Speech api, code: https://github.com/jsgoecke/attspeech (closing)

- Pocket Sphinx (CMU)

- HTK?

June 22, 2016

ubuntu 16.04 dnamsq only local working

in /etc/init.d/dnsmasq, comment out the following line:

DNSMASQ_OPTS="$DNSMASQ_OPTS --local-service"

June 14, 2016

golang serving dynamic and static files


package main

import (

func index_handler(w http.ResponseWriter, r *http.Request) {
        fmt.Fprintf(w, "<html><body>Hi world.<img src=\"/img/kitten.jpg\"></body></html>")

func main() {
        http.Handle("/img/", http.StripPrefix("/img/",http.FileServer(http.Dir("public/img"))))
        http.Handle("/js/",  http.StripPrefix("/js/", http.FileServer(http.Dir("public/js" ))))
        http.Handle("/css/", http.StripPrefix("/css/",http.FileServer(http.Dir("public/css"))))
        http.HandleFunc("/", index_handler)
        http.ListenAndServe(":9000", nil)

Use tshark to display captured conversations

tshark  -r c:\temp\4g2.pcap -q -N "CdnN" "-zconv,udp,!udp.port==53" -zconv,tcp

June 6, 2016

use fswebcam to script webcam picture capturing

 create a config file, use:
nano ~/.fswebcam.conf

The contents of my config file are listed below...

device /dev/video0
input 0
loop 15
skip 20
resolution 320x240
set brightness=60%
set contrast=13%
font /usr/share/fonts/truetype/msttcorefonts/arial.ttf
title "EvilEye cam-O-tron"
timestamp "%d-%m-%Y %H:%M:%S (%Z)"
jpeg 95
save /home/user/pictures/viewcam.jpg
palette MJPEG

Check the fswebcam MAN page for the full range of commands and options. I'm just using those that are relevant to my particular installation.

June 1, 2016

Reset lost password of Windows 2008 R2

The process is simple:

1) Boot Ubuntu 12.04
2) Open the Disk Utility and mount the partition that contains the Windows OS on it (make note of the partition name).  Let us call this “PartName” for now.
3) Open the Terminal application and cd to /media/PartName (where PartName is the name of the Windows partition).
4) cd to Windows/System32      (you are in Ubuntu, so case matters, check the case)
5) cp Utilman.exe Utilman.exe.bak
6) cp cmd.exe Utilman.exe
7) Power off, remove your Ubuntu disk and boot Windows.
8) At the login prompt, press <windows-key>+U
(this will bring up a cmd.exe window running with administrator level privileges)
9) net user <username> <new password> (eg. net user Administrator Pwned123!)

You have just the password for the Administrator account.  Type ‘exit’ to exit the command prompt, and since you are at the login screen, feel free to press CTRL+ALT+DEL and log in.

Don’t forget to open a command prompt window, navigate to c:\windows\system32, and copy Utilman.exe.bak Utilman.exe.  Otherwise, you have left the server open to anyone who walks up and presses <windows-key>+U.  Although it still won’t stop them from doing what I did.

Source: https://joeweaverwindgap.wordpress.com/2013/08/04/how-to-reset-windows-server-2008-r2-domain-controllerdomain-administrator-account-password/