This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from bs4 import BeautifulSoup | |
def get_url_paths(url, ext='', params={}): | |
response = requests.get(url, params=params) | |
if response.ok: | |
response_text = response.text | |
else: | |
return response.raise_for_status() | |
soup = BeautifulSoup(response_text, 'html.parser') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="container"></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
assert dataSource != null | |
assert dataSource.getClass().name == 'org.apache.tomcat.jdbc.pool.DataSource' | |
assert dataSource.getConnection().getClass().name.startsWith('com.sun.proxy') | |
OracleConnection oracleConnection = dataSource.getConnection().unwrap(OracleConnection) | |
assert oracleConnection.getClass().name == 'oracle.jdbc.driver.T4CConnection' | |
NativeJdbcExtractor jdbcExtractor = new CommonsDbcpNativeJdbcExtractor() | |
OracleConnection con = jdbcExtractor.getNativeConnection(dataSource.getConnection()) | |
assert con.getClass().name == 'oracle.jdbc.driver.T4CConnection' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
google.charts.load('current', {'packages':['corechart']}); | |
google.charts.setOnLoadCallback(drawChart); | |
// mock of data retrieved via the API | |
var rawDeviceData = [ | |
{"name": "iPhone7,1", "valid": 303662, "total": 1090913}, | |
{"name": "SM-G920V", "valid": 287159, "total": 1499170}, | |
{"name": "LG-D850", "valid": 221267, "total": 1077458}, | |
{"name": "iPhone8,2", "valid": 186012, "total": 649844} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import xml.etree.ElementTree as ET | |
import json | |
def parse_xml(xmlfile): | |
features = [] | |
output = { | |
"type": "FeatureCollection", | |
"features": features |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groovy.json.* | |
def observationsUrl = 'url_for_xml_file' | |
xmlString = observationsUrl.toURL().text | |
// don't know why can't read URL directly | |
observations = new XmlSlurper().parseText(xmlString) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groovy.json.* | |
import groovy.io.FileType | |
import groovy.util.* | |
import java.util.zip.GZIPInputStream | |
def dataDir = new File("/data/csb_data") | |
assert dataDir.exists() && dataDir.isDirectory() | |
def outputDir = new File("/data/csb_data/csv") | |
assert outputDir.exists() && outputDir.isDirectory() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/bash | |
pid_file="/Users/jcc/pid_file" | |
command="ping -i 60 localhost" | |
############################################################################### | |
## user customization below this should not be required ## | |
############################################################################### | |
function start { | |
echo "starting..." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
pid_file="/path/to/pidfile" | |
command="./t2.sh &" | |
function start { | |
echo "starting..." | |
$command | |
pid=$! | |
echo $pid > $pid_file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// sample JSON response | |
var jsonResponse = {"spatialReference":{"wkid":4326,"latestWkid":4326},"candidates":[{"address":"80305, Boulder, Colorado","location":{"x":-105.24280489999995,"y":39.983092300000067},"score":100,"attributes":{},"extent":{"xmin":-105.28580489999996,"ymin":39.940092300000067,"xmax":-105.19980489999995,"ymax":40.026092300000066}},{"address":"080305","location":{"x":70.684671556000069,"y":42.633023284000046},"score":100,"attributes":{},"extent":{"xmin":70.671671556000064,"ymin":42.620023284000048,"xmax":70.697671556000074,"ymax":42.646023284000044}},{"address":"80305","location":{"x":-107.45293038699998,"y":24.909200000000055},"score":100,"attributes":{},"extent":{"xmin":-107.88393038699998,"ymin":24.478200000000054,"xmax":-107.02193038699998,"ymax":25.340200000000056}},{"address":"080305","location":{"x":25.969188087000077,"y":43.900496861000079},"score":100,"attributes":{},"extent":{"xmin":25.968188087000076,"ymin":43.899496861000081,"xmax":25.970188087000079,"ymax":43.901496861000076}}, |
NewerOlder