Author: kostas

  • London Pirate Radio Documentaries

  • How to compute and plot Bollinger Bands® in Python

    The aim is to produce a plot like this. The orange line is your data, the green line is the upper "bollinger" band, the blue line is the lower "bollinger" band. The red dots indicate where your data is either above or below the bands. Copy-paste this code: import pandas as pd import numpy as […]

  • See who is hosting a website

    To see who is hosting a website (e.g., you will need the IP address of the website and the WHOIS record for that IP address. You can obtain both from the command-line. Obtain the IP address for # Ping the website ping # Alternatively, use traceroute and note the last IP address […]

  • How to chat between computers using netcat on Mac and Linux

    In our home we have a mix of Mac and Linux computers. My children have a Raspberry Pi in their room and I have a Mac at my desk. Today we chatted with each other through the Terminal running on both computers. Hi children! Dudududududududu Am I talking to a bird? ^v^ (It was a […]

  • How to discover devices on your network (Mac/Linux)

    There are several ways to check what devices are currently logged on to your network (e.g. WiFi at home). The first option is to use arp, which I have found works the best. There will be some cases where it does not work. In the following example, I’ll assume that your IP address is […]

  • Frk. Slimas Fornemmelse for Snot

    Af Kostas Kefaloukos Danmark er et lille halvkoldt land, halvlangt mod nord. Det er ikke så koldt at der er særligt meget sne. Til gengæld blæser det meget og regner hele tiden. Disse vejrforhold gør at danskerne ofte bliver forkølede og udvikler store mængder af snot i næse og svælg. På samme måder som grønlænderne […]

  • How to scrape images from the web

    I’m interested in object detection and other computer vision tasks. For example, I’m working on a teddy-bear detector with my son. So, how do you quickly download images for a certain category? You can use this approach that I learned from a course on Udemy. In the above example, the crawler will find images in […]

  • How to fill missing dates in Pandas

    Create a pandas dataframe with a date column: import pandas as pd import datetime TODAY = ONE_WEEK = datetime.timedelta(days=7) ONE_DAY = datetime.timedelta(days=1) df = pd.DataFrame({‘dt’: [TODAY-ONE_WEEK, TODAY-3*ONE_DAY, TODAY], ‘x’: [42, 45,127]}) The dates have gaps: dt x 0 2018-11-19 42 1 2018-11-23 45 2 2018-11-26 127 Now, fill in the missing dates: r = […]

  • Cosine similarity in Python

    Cosine similarity is the normalised dot product between two vectors. I guess it is called “cosine” similarity because the dot product is the product of Euclidean magnitudes of the two vectors and the cosine of the angle between them. If you want, read more about cosine similarity and dot products on Wikipedia. Here is how […]

  • Terms used in shipping

    Now that I work in shipping, it is necessary to learn a bunch of new terms. Shipping is regulated under Admiralty Law and there are traditional documents and parties involved. Knowing what these are is crucial to understanding shipping. Legal documents There are three key documents involved with shipping: Bill of Lading (sometimes abbreviated as […]