Skip to content

Instantly share code, notes, and snippets.

@Redict
Redict / poc.py
Last active May 5, 2024 04:25
WolframAlpha Pro free and unlimited access to API
import requests
from hashlib import md5
from urllib.parse import urlsplit, urlencode, unquote_plus
headers = {"User-Agent": "Wolfram Android App"}
APPID = "3H4296-5YPAGQUJK7" # Mobile app AppId
SERVER = "api.wolframalpha.com"
SIG_SALT = "vFdeaRwBTVqdc5CL" # Mobile app salt
s = requests.Session()
@pianosnake
pianosnake / bounding-box-from-lat-lng-zoom-img-size.js
Last active July 17, 2024 14:19
Get a bounding box from latitude, longitude, zoom level and image size. Useful for getting the bounding box of a static map generated with only those variables.
const EARTH_CIR_METERS = 40075016.686;
const degreesPerMeter = 360 / EARTH_CIR_METERS;
function toRadians(degrees) {
return degrees * Math.PI / 180;
};
function latLngToBounds(lat, lng, zoom, width, height){
const metersPerPixelEW = EARTH_CIR_METERS / Math.pow(2, zoom + 8);
const metersPerPixelNS = EARTH_CIR_METERS / Math.pow(2, zoom + 8) * Math.cos(toRadians(lat));
@joeytwiddle
joeytwiddle / async-await-forEach-alternatives.md
Last active July 22, 2024 09:05
Do not use forEach with async-await

Do not use forEach with async-await

TLDR: Use for...of instead of forEach() in asynchronous code.

For legacy browsers, use for...i or [].reduce()

To execute the promises in parallel, use Promise.all([].map(...))

The problem

@hiroara
hiroara / 三重県.json
Last active March 15, 2024 16:44
Japan Prefectures Geojson
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.