Monday, October 23, 2017

semver = semantic versioning


http://semver.org/

good overview
https://www.sitepoint.com/semantic-versioning-why-you-should-using/

Thursday, September 7, 2017

.NET Core WebApi on Linux (uBuntu)


.NET Core WebApi on Linux (uBuntu)


https://docs.microsoft.com/en-us/aspnet/core/tutorials/web-api-vsc


$ dotnet run
https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-run?tabs=netcore2x

Setting Up a .NET Core Server With Entity Framework Core Using a PostgreSQL Database
https://medium.com/@mikezrimsek/setting-up-a-net-core-server-with-entity-framework-core-using-a-postgresql-database-242438f7d9c3

Handling requests with controllers in ASP.NET Core MVC
https://docs.microsoft.com/en-us/aspnet/core/mvc/controllers/actions

Web API POST - When to use Create, CreatedAtAction, CreatedAtRoute?
https://stackoverflow.com/questions/37839278/asp-net-core-rc2-web-api-post-when-to-use-create-createdataction-vs-created

Model binding JSON POSTs in ASP.NET Core
https://andrewlock.net/model-binding-json-posts-in-asp-net-core/

Switch Off camelCase JSON Binding
https://stackoverflow.com/questions/38202039/json-properties-now-lower-case-on-swap-from-asp-net-core-1-0-0-rc2-final-to-1-0
???

Asp.Net Core Action Results Explained
http://hamidmosalla.com/2017/03/29/asp-net-core-action-results-explained/





Friday, September 1, 2017

Functional Style Programming in Python 3

functional programming in python 3

Why isn't Python very good for functional programming?
stackoverflow.com
http://stackoverflow.com/questions/1017621/why-isnt-python-very-good-for-functional-programming
Learning Data Science Using Functional Python
Joel Grus
https://www.youtube.com/watch?v=ThS4juptJjQ
Functional Programming HOWTO
python foundation
https://docs.python.org/3/howto/functional.html
A practical introduction to functional programming
Mary Rose Cook
https://maryrosecook.com/blog/post/a-practical-introduction-to-functional-programming
Functional programming in Python the simplest way
Anderson Resend
https://www.vinta.com.br/blog/2015/functional-programming-python/
A practical introduction to Functional Programming for Python coders
Sachin Joglekar
https://codesachin.wordpress.com/2016/04/03/a-practical-introduction-to-functional-programming-for-python-coders/

Wednesday, August 23, 2017

recursion in python


limits on the maximum depth of recursion

RecursionError: maximum recursion depth exceeded

https://stackoverflow.com/questions/3323001/what-is-the-maximum-recursion-depth-in-python-and-how-to-increase-it


sys.setrecursionlimit(new_limit_value)

unexpected python scoping

global
nonlocal

https://www.python.org/dev/peps/pep-3104/

https://stackoverflow.com/questions/5218895/python-nested-functions-variable-scoping

nonlocal
https://docs.python.org/3/reference/simple_stmts.html#the-nonlocal-statement

https://stackoverflow.com/questions/5772935/why-doesnt-a-sub-function-inherit-scope-in-python

Sunday, August 20, 2017

io module - file and stream based io in python3

io module @ python 2.6 docs

>>>

New in version 2.6.

The io module provides the Python interfaces to stream handling. Under Python 2.x, this is proposed as an alternative to the built-in file object, but in Python 3.x it is the default interface to access files and streams.

Note

Since this module has been designed primarily for Python 3.x, you have to be aware that all uses of “bytes” in this document refer to the str type (of which bytes is an alias), and all uses of “text” refer to the unicode type. Furthermore, those two types are not interchangeable in the io APIs.

<<<

Saturday, May 6, 2017

js reference

Here is a collection of good introductions, overviews, clarifications and tutorials on various relevant javascript topics.

javascript

string formatting
- text formatting @ MDN https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Text_formatting
- JavaScript equivalent to printf/string.format @ stackoverflow.com http://stackoverflow.com/questions/610406/javascript-equivalent-to-printf-string-format

python3 reference

Here is a collection of good introductions, overviews, clarifications and tutorials on various relevant python3 topics.

python 3

string formatting
- https://pyformat.info/

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/#/

Saturday, April 30, 2016

Mark Down Markup Language

wikipedia:

Markdown is a lightweight markup language with plain text formatting syntax designed so that it can be converted to HTML and many other formats using a tool by the same name.[8][9] Markdown is often used to format readme files, for writing messages in online discussion forums, and to create rich text using a plain text editor.

PDF cheat-sheet: https://guides.github.com/pdfs/markdown-cheatsheet-online.pdf

end 



Friday, March 25, 2016

Open Source Queueing Systems


Top 5 Open Source AMQP (Advanced Message Queing Protocol) Implementations
https://www.rabbitmq.com/

- Rabbit MQ @ https://www.rabbitmq.com/
- Open AMQ @ http://www.openamq.org/
- Storm MQ @ http://stormmq.com/
- Apache QPID @ https://qpid.apache.org/
- RedHat Enterprise MRG @ https://access.redhat.com/products/red-hat-enterprise-mrg-realtime

Monday, March 21, 2016

steve wozniak

Bloomberg Business Week - youtube - https://www.youtube.com/watch?v=pJif4i9NRdI

Tuesday, February 2, 2016

Visual Studio - Bind 'Ctrl + w' to Close Current Window

Tools > Options > Environment > Keyboard

Show commands containing:  File.Close
Press shortcut keys:  'Ctrl + w'
Assign

Show commands containing:  Edit.SelectCurrentWord
Remove
OK