Archive

Archive for April, 2017

How To Build a Prediction API in 10 Minutes with Flask, Swagger, and SciPy

April 29, 2017 Leave a comment

iamalivingcontradiction

I’ve seen a lot of hype around Prediction APIs, recently. This is obviously a byproduct of the current data science fad.

As a public service, I’m going to show you how you can build your own prediction API … and I’ll do it by creating a very basic version in 10 minutes.

We will build an API that will determine if we should provide credit to someone based on certain demographic information.

We will use Kaggle’s “Give Me Some Credit” dataset as the basis for this example.

Go to the “Give Me Some Credit” page, and download the files.

You will have 4 files:

  • cs-training.csv
  • cs-test.csv
  • sampleEntry.csv
  • DataDictionary.xls

We will only need the cs-training.csv and DataDictionary.xls files for this project.

Create application folder

Use the following commands to create a directory and move into it.



This file contains bidirectional Unicode text that may be interpreted or compiled…

View original post 1,850 more words

Categories: Interesting

You don’t need a Linkedin account

April 26, 2017 Leave a comment

In recent years, Linkedin has perceivably become a rather important part of the modern business world. People use this social network to search for jobs, advertise jobs, and get their own work-related resume out there into the spotlight. Which is why I always get a funny look when people ask me to add them on Linkedin, and I tell them, I don’t have one.

The same why I told you why you should not be using Facebook back in 2010, and the arguments still hold valid, I would like to tell you why you might want to entertain the idea of not having a business profile on a social media site, and why this could actually be good for your career. To wit, let us philosophize.

http://www.dedoimedo.com/life/linkedin-unnecessary.html

Categories: Interesting

Installing Elasticsearch 2.4

April 25, 2017 Leave a comment

Problem: Elasticsearch 2.4 on vm.

Solution:
Pretty straight foward if you following the instructions on the Elasticsearch site.

1. Setup a new box.

$ vagrant init ubuntu/trusty64
$ vagrant up
$ vagrant ssh

2. Download java.
http://docs.oracle.com/javase/8/docs/technotes/guides/install/linux_jdk.html#BJFJJEFG

3. Install java.
As per instructions below.
http://www.wikihow.com/Install-Oracle-Java-JDK-on-Ubuntu-Linux

Once you have java running on your vm.

$ java -version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)

4. Install Elasticsearch.
As per guide below.
https://www.elastic.co/guide/en/elasticsearch/reference/2.4/_installation.html

$ cd elasticsearch-2.4.4/bin
$ ./elasticsearch
[2017-04-25 09:52:24,646][INFO ][node                     ] [Thundra] version[2.4.4], pid[7102], build[fcbb46d/2017-01-03T11:33:16Z]
[2017-04-25 09:52:24,652][INFO ][node                     ] [Thundra] initializing ...
[2017-04-25 09:52:25,905][INFO ][plugins                  ] [Thundra] modules [reindex, lang-expression, lang-groovy], plugins [], sites []
[2017-04-25 09:52:26,009][INFO ][env                      ] [Thundra] using [1] data paths, mounts [[/ (/dev/sda1)]], net usable_space [34.6gb], net total_space [39.3gb], spins? [possibly], types [ext4]
[2017-04-25 09:52:26,011][INFO ][env                      ] [Thundra] heap size [1015.6mb], compressed ordinary object pointers [true]
[2017-04-25 09:52:26,012][WARN ][env                      ] [Thundra] max file descriptors [4096] for elasticsearch process likely too low, consider increasing to at least [65536]
[2017-04-25 09:52:30,427][INFO ][node                     ] [Thundra] initialized
[2017-04-25 09:52:30,429][INFO ][node                     ] [Thundra] starting ...
[2017-04-25 09:52:30,657][INFO ][transport                ] [Thundra] publish_address {127.0.0.1:9300}, bound_addresses {[::1]:9300}, {127.0.0.1:9300}
[2017-04-25 09:52:30,669][INFO ][discovery                ] [Thundra] elasticsearch/I1jPodmCSGG4YanF0bceyQ
[2017-04-25 09:52:33,738][INFO ][cluster.service          ] [Thundra] new_master {Thundra}{I1jPodmCSGG4YanF0bceyQ}{127.0.0.1}{127.0.0.1:9300}, reason: zen-disco-join(elected_as_master, [0] joins received)
[2017-04-25 09:52:33,786][INFO ][http                     ] [Thundra] publish_address {127.0.0.1:9200}, bound_addresses {[::1]:9200}, {127.0.0.1:9200}
[2017-04-25 09:52:33,788][INFO ][node                     ] [Thundra] started
[2017-04-25 09:52:33,844][INFO ][gateway                  ] [Thundra] recovered [0] indices into cluster_state
$ curl 'localhost:9200/_cat/health?v'
epoch      timestamp cluster       status node.total node.data shards pri relo init unassign pending_tasks max_task_wait_time active_shards_percent
1493114161 09:56:01  elasticsearch green           1         1      0   0    0    0        0             0                  -                100.0%
Categories: elasticsearch Tags: , ,

Enable ssh X11 forwarding on Vagrant boxes

April 22, 2017 Leave a comment

Problem:
I got the following error when trying to run tkinter on a vagrant box. (Ubuntu/trusty32).

TclError: no display name and no $DISPLAY environment variable

Solution:
Forward X11 Display to the host machine.

Following the tutorial shown in the source section below, the minimum I needed to do was to add

config.ssh.forward_x11 = true

to the Vagrantfile.

$ less Vagrantfile
  # Every Vagrant development environment requires a box. You can search for
  # boxes at https://atlas.hashicorp.com/search.
  config.vm.box = "ubuntu/trusty32"

  # Forward X11
   config.ssh.forward_x11 = true

Then, vagrant up, vagrant ssh, then tried to run the python code again. Code works as expected.

Update:
I missed some steps here
On the guest (I am running ubuntu)
1. Install xauth

$ sudo apt-get install xauth
$ sudo apt-get install x11-apps

2. Add to the Vagrant file

# Forward X11
config.ssh.forward_agent = true
config.ssh.forward_x11 = true

3. After vagrant reload, vagrant ssh and Test.

# Run xeyes on the guest
$ xeyes

NB. No need to export DISPLAY=:0.0

Source
http://computingforgeeks.com/how-to-enable-and-use-ssh-x11-forwarding-on-vagrant-instances/
https://www.vagrantup.com/docs/vagrantfile/ssh_settings.html

Categories: vagrant

Redis as a JSON store

April 21, 2017 Leave a comment

tl;dr a Redis module that provides native JSON capabilities – get it from the GitHub repository or read the docs online. Both JSON and Redis need no introduction; the former is the standard data interchange format between modern applications, whereas the latter is ubiquitous wherever performant data management is needed by them. That being the […]

via Redis as a JSON store — thoughts…

Categories: Interesting Tags: ,

The real prerequisite for machine learning isn’t math. It’s data analysis.

April 21, 2017 Leave a comment

When beginners get started with machine learning, the inevitable question is “what are the prerequisites? What do I need to know to get started?” And once they start researching, beginners frequently find well-intentioned but disheartening advice, like the following: You need to master math. You need all of the following: – Calculus – Differential equations […]

via The real prerequisite for machine learning isn’t math, it’s data analysis — thoughts…

Baidu Will Release a Free Operating System for Self-Driving Cars

April 21, 2017 Leave a comment

Baidu is releasing much of the technology behind its self-driving car, a move that it hopes will fast-track the technology’s progress while cementing the company’s role in supplying key elements such as mapping and machine-learning systems.

Most of the companies developing automated driving carefully guard the technology and expertise behind their systems, as a series of legal battles between competitors highlight. Baidu’s move could perhaps lead to a more open effort and lower the bar for developing advanced driver-assist systems as well as self-driving prototypes.

https://www.technologyreview.com/s/604220/baidu-will-release-a-free-operating-system-for-self-driving-cars/

Categories: Interesting

Rate Limiting with Nginx

April 19, 2017 Leave a comment

Do you manage a website? Does it have a login form? Can somebody brute force attack it with every common username/password combination until they find one that works?

For many small web applications, the answer to all of the above is, “yes”. This is a security risk and the solution is rate limiting. Rate limiting allows you to slow down the rate of requests and even deny requests beyond a specific threshold. Unfortunately, for most busy web developers, rate limiting is often tossed into a large pile of “things I know I should do, but don’t have time for”.

Advanced rate limiting apps such as django-ratelimit exist, but if you use Nginx as a reverse proxy to your application, the solution is almost trivial.

https://lincolnloop.com/blog/rate-limiting-nginx/

Categories: Interesting

Building a Bank with Go

April 19, 2017 Leave a comment

Summary
Matt Heath discusses why Go is suited for a microservices architecture, the language features that make it particularly attractive to high volume, low latency, distributed applications, and how easy it is to adopt into existing systems and organisations.

https://www.infoq.com/presentations/bank-go

How criminals can steal your PIN by tracking the motion of your phone

April 13, 2017 Leave a comment

Hackers are able to decipher PINs and passwords just from the way we tilt our phone when we are typing in the information.

Cyber experts at Newcastle University, UK, have revealed the ease with which malicious websites, as well as installed apps, can spy on us using just the information from the motion sensors in our mobile phones.

Analysing the movement of the device as we type in information, they have shown it is possible to crack four-digit PINs with a 70% accuracy on the first guess – 100% by the fifth guess – using just the data collected via the phone’s numerous internal sensors.

http://www.ncl.ac.uk/press/news/2017/04/sensors/#hp-banner

Categories: Interesting