Skip to content

Instantly share code, notes, and snippets.

View jmwenda's full-sized avatar

Jude Mwenda jmwenda

View GitHub Profile
@jmwenda
jmwenda / cartodb-utils.py
Created March 13, 2017 12:58 — forked from andrewxhill/cartodb-utils.py
command-line python interface for manipulating data on CartoDB
import os
import urllib
import urllib2
import base64
import json
import sys
import argparse
try:
import requests
except ImportError:
2017-03-11 16:55:57,302:INFO:__main__:1211: Generating new account key
2017-03-11 16:56:00,513:ERROR:acme.challenges:324: Unable to reach http://my-new-app.afrigeo.com/.well-known/acme-challenge/6AvbTaRjUDbyfy9rvAANb_nAHLhaGGce1YyOmo7qt18: HTTPSConnectionPool(host='my-new-app.afrigeo.com', port=443): Max retries exceeded with url: /.well-known/acme-challenge/6AvbTaRjUDbyfy9rvAANb_nAHLhaGGce1YyOmo7qt18 (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f05dc42f810>: Failed to establish a new connection: [Errno 111] Connection refused',))
command="FINGERPRINT=SHA256:g4ZT4LZcW17SJDNXjYCnYCIDCDwxEUZzJgdg6JKQeKk NAME=\"laptop\" `cat /home/dokku/.sshcommand` $SSH_ORIGINAL_COMMAND",no-agent-forwarding,no-user-rc,no-X11-forwarding,no-port-forwarding ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDkNHymz/Ou/MnZGneuZQsCIYAGKxOh/DvKEgEZCMXnoHKjK5gzcI4LEkUmar6KX8c8SYRX3E2+rXB1mQBmVwyRmwmBaoAZYufQjyxSykGACHPwj9zPYhCc8Xh6Rnby88palBJSRnC6k61OTn3qEpXy/4HC3GINAIJdmi2uMkui7wN2roCuNjJooZU3Gxxz7u5gV1x/WBqdfAoOrQivFjqebFHA78SPAWfss3gogOTdp/Go8BiS3cDrHUsfuOJ8gLYMThF0u0Y3vTPVfaT5SND+87SYsqMpNLhEPs0wjXLBos0pSALGINnurIbv69c283mMLK2Pk2UQ6G4PRZwj5dHrZ2KEiLd5mYfJ1QmVjeDYowjaZxMkHAmW09HbKJG32APTCiiZM0d1z/nmUQiSeq8nGlFZTjXdE7vcuwnXcBdD7WiTXLlGNmn6j/LGaWTuuCo/Xjq2WdjoipWHNWrmTbWL8C4kXOcTbvafKErNmq8NfW6A7VQXnIhb1i2BhxVLERy1HbCLVevFUbArouPmy0PWd4YNZNpDNNJZtIIOpZky+p9Bt73FAorsQ5JecL4kb3Qky3LcY/+b51FUKdCxY5rS4QelHyqu1uIHNpCKXc5E0qcasP1guCNT6o9rYP3+8CTPNr0d2II6sfZnoQIvpqKaLGBjFzywmJvBwJjfE4S3CQ== judemwenda@gmail.com
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jmwenda
jmwenda / svmsample.csv
Last active March 7, 2017 14:58
svmsampl
xvalue yvalue Class
5 16 A
14 0 A
9 5 A
6 12 A
15 4 A
8 10 A
11 8 A
13 13 A
1 0 B
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
Malignant Tumor
65.0 59.8
63.3 63.2
65.0 63.3
65.8 62.8
61.1 64.3
63.0 64.2
65.4 64.1
64.7 64.0
66.1 64.6
import csv
import requests
API_KEY = 'mapzen-qf13gJX'
BASE_URL = 'https://search.mapzen.com/v1/search'
with open('O4W_TAX_2011_2016_NC.csv','rU') as csvfile:
#data = csv.reader( csvfile, dialect=csv.excel_tab)
data = csv.reader(csvfile, delimiter=',', quotechar='"', quoting=csv.QUOTE_NONE, dialect=csv.excel_tab)
next(data, None)
new_rows_list = []
<!DOCTYPE html>
<html>
<head>
<title>Custom infowindow example | CartoDB.js</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link rel="shortcut icon" href="http://cartodb.com/assets/favicon.ico" />
<style>
html, body, #map {
height: 100%;
<!DOCTYPE html>
<html>
<head>
<title>Named Maps Tutorial | CartoDB</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link rel="shortcut icon" href="http://cartodb.com/assets/favicon.ico" />
<style>
html, body, #map {
<!DOCTYPE html>
<html>
<head>
<title>Named Maps Tutorial | CartoDB</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link rel="shortcut icon" href="http://cartodb.com/assets/favicon.ico" />
<style>
html, body, #map {