Skip to content

Instantly share code, notes, and snippets.

@ewheeler
ewheeler / .gitignore
Last active February 7, 2024 06:11
timezone map
.DS_Store
build
node_modules
@ewheeler
ewheeler / overpass-turbo-admin-boundaries-query.js
Last active October 4, 2023 01:27
Overpass-Turbo query for viewing administrative boundaries
/*
This is an example Overpass query to view administrative boundaries.
1. Visit the OpenStreetMaps wiki (http://wiki.openstreetmap.org/wiki/Tag:boundary%3Dadministrative) and see which levels are present for your country. If admin_level = N/A, that level is missing.
2. Go to http://overpass-turbo.eu and centre the map on the country of interest.
3. Delete the text on the left side of the overpass-turbo page and replace with the contents of this file
4. Edit the admin_level to the level you want to check - in the example above, the "admin_level" = "8". Press 'Run' to highlight and outline all boundaries for that level.
@ewheeler
ewheeler / gist:cd96f46aa07517be400825b5be7cefd6
Created April 14, 2023 18:40
superset-dashboard-cloner exception
Creating empty dashboard 'RapidPro 2022 messages' from 'RapidPro 2021 messages'...
send: b'POST /api/v1/security/login HTTP/1.1\r\nHost: localhost:8088\r\nUser-Agent: python-requests/2.28.1\r\nAccept-Encoding: gzip, deflate, br\r\nAccept: */*\r\nConnection: keep-alive\r\nContent-Length: 86\r\nContent-Type: application/json\r\n\r\n'
send: b'{"username": "zzz", "password": "xxx", "provider": "db", "refresh": false}'
reply: 'HTTP/1.1 200 OK\r\n'
header: Server: gunicorn
header: Date: Fri, 14 Apr 2023 18:17:10 GMT
header: Connection: keep-alive
header: Content-Type: application/json; charset=utf-8
header: Content-Length: 287
header: Set-Cookie: session=8b8af0a2-e2dc-42ae-bdd5-fb78f91b82ec; Expires=Mon, 15-May-2023 18:17:10 GMT; HttpOnly; Path=/; SameSite=Lax
@ewheeler
ewheeler / gist:2974886
Created June 22, 2012 20:07
capture client-side javascript errors and log to server
// for support before ECMA-262 5th edition ...
if (!Date.now) {
Date.now = function now() {
return +(new Date);
};
}
// keep track of how many errors have been logged to server
var num_errors = 0;
var max_errors = 10;
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ewheeler
ewheeler / gist:1262989
Created October 4, 2011 22:12
flask + tornado + nginx + supervisord
# create stub, then run flask app in tornado on port 5000 (perhaps with supervisord config below http://supervisord.org/index.html)
#!/usr/bin/env python
from tornado.wsgi import WSGIContainer
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from myflaskapp import app
http_server = HTTPServer(WSGIContainer(app))

Keybase proof

I hereby claim:

  • I am ewheeler on github.
  • I am evmw (https://keybase.io/evmw) on keybase.
  • I have a public key ASBLPnLx7emRelngbk8fppavGyg0HV_O1-Zs1LzGNMNgZwo

To claim this, I am signing this object:

#!/usr/bin/ruby
# vim: noet noai
require "md5"
user = "rm129"
pass = "adam"
url = "http://192.168.10.1/login"
login = `curl -s #{url}`
@ewheeler
ewheeler / run-in-screen.sh
Created July 21, 2017 19:49
run redash services in a tabbed screen session
screen -AdmS redash
screen -S redash -X screen -t flask bin/run ./manage.py runserver --debugger --reload
screen -S redash -X screen -t celery ./bin/run celery worker --app=redash.worker --beat -Qscheduled_queries,queries,celery -c2
screen -S redash -X screen -t client npm run start
[circus]
statsd = 1
stats_endpoint = tcp://127.0.0.1:5557
httpd = 1
httpd_host = 127.0.0.1
httpd_port = 8001
endpoint = tcp://127.0.0.1:5555
pubsub_endpoint = tcp://127.0.0.1:5556
check_delay = 5
logoutput = logs/circus.log