Skip to content

Instantly share code, notes, and snippets.

View abeusher's full-sized avatar
💭
Thinking

Abe Usher abeusher

💭
Thinking
View GitHub Profile
@abeusher
abeusher / wcle
Created November 27, 2022 23:12
word count line estimator - a very fast version of "wc -l" that is approximate
# update <username> with your linux username
# mkdir -p ~/.local/bin
# touch ~/.local/bin/wcle
# put this line in the file ~/.local/bin/wcle
python3 /home/<username>/.local/bin/wcle.py $1
# chmod +x ~/.local/bin/wcle
# copy the file wcle.py to ~/.local/bin/
# enjoy!
id,name,amount
109,"building",1456894
164,"house",1383613
7,"Shopping and services",839415
17,"store / shop",831628
203,"school",676869
4,"dining and leisure",671035
74,"restaurant",385073
194,"park",283545
163,"sport venue",274433
@abeusher
abeusher / classify_image.py
Created July 15, 2019 00:46 — forked from aallan/classify_image.py
Image classifier python demonstration code for use with Google's Edge TPU
"""A demo to classify image."""
import argparse
from edgetpu.classification.engine import ClassificationEngine
from PIL import Image
# Function to read labels from text files.
def ReadLabelFile(file_path):
with open(file_path, 'r') as f:
lines = f.readlines()
ret = {}
@abeusher
abeusher / instructions.txt
Created July 12, 2019 00:23 — forked from malkitsingh/instructions.txt
Step by step guide to install nominatim server
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
@abeusher
abeusher / resque.py
Created February 24, 2019 02:38 — forked from defunkt/resque.py
Resque client in Python
from redis import Redis
import simplejson
class Resque(object):
"""Dirt simple Resque client in Python. Can be used to create jobs."""
redis_server = 'localhost:6379'
def __init__(self):
host, port = self.redis_server.split(':')
self.redis = Redis(host=host, port=int(port))
package main
import (
"bufio"
"log"
"os"
)
var concurrency = 100
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
import quadtree
def main():
#adopted from https://github.com/hkwi/python-geohash
#set up spatial coordinate system