Wednesday, April 26, 2017

Visual Studio Code - vscode

linux setup
@ https://code.visualstudio.com/docs/setup/linux

Monday, October 31, 2016

cpu benchmarking on linux with sysbench

TL;DR

install synaptic package
$ sudo apt-get install sysbench

run
$ sysbench --num-threads=1 --test=cpu --cpu-max-prime=25000 run


from the man page @ http://man.cx/sysbench(1)
DESCRIPTION

SysBench is a modular, cross−platform and multi−threaded benchmark tool for evaluating OS parameters that are important for a system running a database under intensive load.

The idea of this benchmark suite is to quickly get an impression about system performance without setting up complex database benchmarks or even without installing a database at all.

Current features allow to test the following system parameters:

• file I/O performance
• scheduler performance
• memory allocation and transfer speed
• POSIX threads implementation performance
• database server performance

The design is very simple. SysBench runs a specified number of threads and they all execute requests in parallel. The actual workload produced by requests depends on the specified test mode. You can limit either the total number of requests or the total time for the benchmark, or both.

Available test modes are implemented by compiled−in modules, and SysBench was designed to make adding new test modes an easy task. Each test mode may have additional (or workload−specific) options.

...

TEST MODEs

CPU

The cpu is one of the most simple benchmarks in SysBench. In this mode each request consists in calculation of prime numbers up to a value specified by the −−cpu−max−primes option. All calculations are performed using 64−bit integers.

Each thread executes the requests concurrently until either the total number of requests or the total execution time exceed the limits specified with the common command line options.

Example:
$ sysbench --test=cpu run

--- --- --- --- --- ---

sample output - Lenovo IdeaPad 300:

dog@cat:~$ sysbench --num-threads=4 --test=cpu --cpu-max-prime=25000 run
sysbench 0.4.12:  multi-threaded system evaluation benchmark

Running the test with following options:
Number of threads: 4

Doing CPU performance benchmark

Threads started!
Done.

Maximum prime number checked in CPU test: 25000

Test execution summary:
    total time:                          12.2696s
    total number of events:              10000
    total time taken by event execution: 49.0625
    per-request statistics:
         min:                                  4.22ms
         avg:                                  4.91ms
         max:                                 34.80ms
         approx.  95 percentile:               5.20ms

Threads fairness:
    events (avg/stddev):           2500.0000/28.85
    execution time (avg/stddev):   12.2656/0.00

Thursday, September 29, 2016

convert m4a to mp3 in lunux via the command line

ex Lord Neckbeard at SuperUser

http://superuser.com/questions/704493/ffmpeg-convert-m4a-files-to-mp3-without-significant-loss-of-information-quali

$ mkdir mp3
$ for f in *.m4a; do ffmpeg -i "$f" -codec:v copy -codec:a libmp3lame -q:a 2 mp3/"${f%.m4a}.mp3"; done

Saturday, September 3, 2016

getting set up with the raspberry pi 3 B and ubuntu linux

1. download the 16-04 for Pi3B image from the official Canonical page.

With the release of the Raspberry Pi 2 Model B and its ARMv7-based BCM2709 processor, it is now possible to run Ubuntu directly on the Raspberry Pi.
...
Raspberry Pi 3: ubuntu-16.04-preinstalled-server-armhf+raspi3.img.xz (4G image, 216M compressed)
...
This Raspberry Pi 3 image is built by Ryan Finnie using modified Xenial packages in a PPA (ppa:ubuntu-raspi2/ppa-rpi3), and is not supported directly by Canonical. 

2. initialize the SD card with the image

2.1 Decompress the archived image from within the Nautilus file explorer using the archive manager that comes pre-installed with 16-04.

2.2 uBuntu 16-04 comes pre-installed with a GUI disk-image tool 'Startup Disk Creator', which is as complicated to use as selecting the the image and the SD card.

3. login and configure

// at this point you will need to plug in a keyboard and monitor.

Login username is "ubuntu", password is "ubuntu". You will be asked to change the password on first login.

4. install the development platform

since we're going for a lite-weight install, and installing even the optimized xubuntu-desktop would require something like 1.6GB of space, so drop that idea, we're flying from the terminal.

I have plans for working in all of javascript, python and mono.NET, but since mono tends to be something of a beast, I'm going to get started with js/py only.


4.0 web server

// nginx
$ sudo apt-get install nginx

4.1 persistence


4.1.1 mongodb


32-bit version @ 2.6.10

- database limited to 2GB in size

// install
$ sudo apt-get install mongodb

// launch shell
$ sudo mongo

4.1.1 postgresql


$ sudo apt-get install postgresql


4.2 python /django web server stack

python3 (pre-installed)

// django web server
$ sudo apt-get install python-django

4.3 javascript / nodejs / express web server stack


4.3.1 nodejs & package management


$ sudo apt-get install nodejs
$ sudo apt-get install npm
$ sudo apt-get install bower

4.3.2 persistence

$ sudo npm install -g pg
$ sudo npm install -g mongo
 
5.0 install infosec tools

5.1 scapy wifi tools

// scapy dependencies

// python crypto
$ sudo apt-get install python-crypto

// python graphics
$ sudo apt-get install python-pyx

$ sudo apt-get install gnuplot
$ sudo apt-get install python-gnuplot

// scapy
$ sudo apt-get install python-scapy

5.2 reaver
 
$ sudo apt-get install reaver

5.3 pyscard = python smartcard

// python 2
$ sudo apt-get install python-pyscard
// python 3
$ sudo apt-get install python3-pyscard


Monday, August 29, 2016

Install MongoDB 3.? on uBuntu 1604

Official Instructions
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/

then create folder @ /data/db, i.e.
$ sudo mkdir /data
$ sudo mkdir /data/db


then fix file permissions:
$ sudo chown -R `id -u` /data/db

Saturday, July 2, 2016

Debugging nodejs w Chromium

electron
https://github.com/electron/electron
>>
The Electron framework lets you write cross-platform desktop applications
using JavaScript, HTML and CSS. It is based on Node.js and
Chromium and is used by the Atom
editor and many other apps.
<< 

https://mattdesl.svbtle.com/debugging-nodejs-in-chrome-devtools
 
# first install electron
$ sudo ln -s /usr/bin/nodejs /usr/local/bin/node
# DO NOT CONFUSE electron-prebuilt package (correct) with electron package (wrong) 
$ sudo npm install -g electron-prebuilt
 
# then devtool 
$ sudo npm install -g devtool
 
# run devtool from the cmd line, debugging server.js
$ devtool server.js --watch 

Friday, July 1, 2016

nodejs Modules

For reference, the official documentation is
@ https://nodejs.org/api/modules.html

Darren de Ridder (https://twitter.com/73rhodes)
has an excellent summary presentation on github.io
Node.JS Module Patterns Using Simple Examples
@ https://darrenderidder.github.io/talks/ModulePatterns/#/