Skip to content

Instantly share code, notes, and snippets.

View answerquest's full-sized avatar

Nikhil VJ answerquest

View GitHub Profile
@KL13NT
KL13NT / spotify-dl.bat
Last active January 1, 2022 05:57
Spotify-dl: A NodeJS script to download spotify tracks from youtube. Depends on node-fetch and youtube-dl.
@echo off
SET CLIENT_ID=
SET CLIENT_SECRET=
SET YOUTUBE_KEY=
node PATH\TO\SCRIPT\spotify-dl.js %1
rem %1 track link
rem this file may be added to your env to quickly execute the script anywhere on your pc.
@pangyuteng
pangyuteng / Dockerfile
Last active April 25, 2024 02:16
docker miniconda ubuntu
#
# ref https://github.com/tebeka/pythonwise/blob/master/docker-miniconda/Dockerfile
#
# miniconda vers: http://repo.continuum.io/miniconda
# sample variations:
# Miniconda3-latest-Linux-armv7l.sh
# Miniconda3-latest-Linux-x86_64.sh
# Miniconda3-py38_4.10.3-Linux-x86_64.sh
# Miniconda3-py37_4.10.3-Linux-x86_64.sh
#

OSRM North America route server on EC2

Overview

OSRM route server is an extremely useful tool for getting the driving distance/time through multiple locations. The route server requires data that has to be downloaded and processsed before it can be used to serve routes from.

Processing OSRM data for large region like North America can be a real challenge due to memory and disk size requirements. It's also really time consuming. If you cut and try from scratch, you will repeatedly run into some constraints and fail after hours of running.

The following are summary notes from trying this with eventual success.

@MichaelStetner
MichaelStetner / total_seconds.py
Created October 31, 2017 20:29
Convert any timedelta to seconds
def total_seconds(timedelta):
"""Convert timedeltas to seconds
In Python, time differences can take many formats. This function can take
timedeltas in any format and return the corresponding number of seconds, as
a float.
Beware! Representing timedeltas as floats is not as precise as representing
them as a timedelta object in datetime, numpy, or pandas.
@umidjons
umidjons / youtube-dl-download-audio-only-on-best-quality.md
Last active March 9, 2024 07:54
Download Audio from YouTube with youtube-dl

Download Audio from YouTube

-i - ignore errors

-c - continue

-t - use video title as file name

--extract-audio - extract audio track

@systemed
systemed / gist:be2d6bb242d2fa497b5d93dcafe85f0c
Last active April 10, 2024 03:49
Routing algorithm implementations
(Dijkstra and plain A* are generally not included here as there are thousands of
implementations, though I've made an exception for rare Ruby and Crystal versions,
and for Thor, Mapzen's enhanced A*. )
A* Ruby https://github.com/georgian-se/shortest-path
A* Crystal https://github.com/petoem/a-star.cr
A* (bidirectional with shortcuts) C++ https://github.com/valhalla/valhalla
NBA* JS https://github.com/anvaka/ngraph.path
NBA* Java https://github.com/coderodde/GraphSearchPal
NBA* Java https://github.com/coderodde/FunkyPathfinding
@jadeallenx
jadeallenx / t.py
Created January 10, 2017 22:14
Parsing hex protobuf files in python
>>> import charm.proto.hex_pb_signed_pb2
>>> s = charm.proto.hex_pb_signed_pb2.Signed()
>>> import charm.proto.hex_pb_package_pb2
>>> pkg = charm.proto.hex_pb_package_pb2.Package()
>>> pkgbuf = None
>>> with open("test/gisla.unc") as f:
... pkgbuf = f.read()
...
>>> s.ParseFromString(pkgbuf)
>>> s.payload
@diegopacheco
diegopacheco / pip3-python3-ubuntu.md
Created January 5, 2017 13:46
How to Install pip3 on python3 Ubuntu 16.04
sudo apt-get install python3-setuptools
sudo easy_install3 pip
@emoran
emoran / polygone_google_maps.html
Last active October 15, 2020 13:42
Adding polygone in google maps
<!DOCTYPE html>
<html>
<head>
<title>Drawing tools</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<style>
/* Always set the map height explicitly to define the size of the div
* element that contains the map. */
@danswick
danswick / README.md
Last active October 11, 2017 07:04
Get weather conditions along a route

Click to get a route and retrieve weather information at a given interval along the way. Currently displaying wind speed.

Includes superfluous data point extrusions.