The program below can take one or more plain text files as input. It works with python2 and python3.
Let's say we have two files that may contain email addresses:
- file_a.txt
foo bar
ok [email protected] sup
[email protected],wyd
hello world!
The program below can take one or more plain text files as input. It works with python2 and python3.
Let's say we have two files that may contain email addresses:
foo bar
ok [email protected] sup
[email protected],wyd
hello world!
When hosting our web applications, we often have one public IP
address (i.e., an IP address visible to the outside world)
using which we want to host multiple web apps. For example, one
may wants to host three different web apps respectively for
example1.com
, example2.com
, and example1.com/images
on
the same machine using a single IP address.
How can we do that? Well, the good news is Internet browsers
/* | |
Based on: | |
1. http://stephen.io/mediaqueries | |
2. https://css-tricks.com/snippets/css/media-queries-for-standard-devices/ | |
*/ | |
/* iPhone X in portrait & landscape */ | |
@media only screen | |
and (min-device-width : 375px) | |
and (max-device-width : 812px) |
// How to connect 5 publishers with 5 subscribers | |
// over TCP using ZeroMQ's XPUB/XSUB proxy. | |
// sub (connect) | |
// <-8701-> | |
// (bind) xpub <---> xsub (bind) | |
// <-8700-> | |
// (connect) pub | |
var zmq = require('zmq'); |
// Don't forget to add Palette library to your build.gradle | |
// compile 'com.android.support:palette-v7:+' | |
public static int getDominantColor(Bitmap bitmap) { | |
List<Palette.Swatch> swatchesTemp = Palette.from(bitmap).generate().getSwatches(); | |
List<Palette.Swatch> swatches = new ArrayList<Palette.Swatch>(swatchesTemp); | |
Collections.sort(swatches, new Comparator<Palette.Swatch>() { | |
@Override | |
public int compare(Palette.Swatch swatch1, Palette.Swatch swatch2) { | |
return swatch2.getPopulation() - swatch1.getPopulation(); |
I followed these two blogs to install server | |
1. http://koo.fi/blog/2015/03/19/openstreetmap-nominatim-server-for-geocoding/#Compile_Nominatim | |
This explains ( and is the main blog which I followed) various steps | |
2. https://www.linuxbabe.com/linux-server/openstreetmap-tile-server-ubuntu-16-04 | |
This explains how to setup swap files and install tiles if needed. | |
I will use Ubuntu 14.04 LTS as the platform. Just a basic install with ssh server. We will install Apache to serve http requests. Make sure you have enough disk space and RAM to hold the data and serve it efficiently. I used the Finland extract, which was about a 200 MB download. The resulting database was 26 GB after importing, indexing and adding Wikipedia data. The Wikipedia data probably actually took more disk space than the OSM data. My server has 4 GB RAM, which seems to be enough for this small data set. | |
1. Sofware requirements |
class LocationRequestHelper(private val context: Context, | |
private val locationRequest: LocationRequest, | |
lifecycle: Lifecycle, | |
private val onResult: (LocationResult) -> Unit) : LifecycleObserver { | |
private val locationClient by lazy { FusedLocationProviderClient(context) } | |
private val settingsClient by lazy { LocationServices.getSettingsClient(context) } | |
private val locationSettingRequest by lazy { | |
LocationSettingsRequest.Builder() |