Skip to content

Instantly share code, notes, and snippets.

View dbpedia docker
docker run -tid \
--restart unless-stopped \
--name dbpedia-spotlight.en \
--mount source=spotlight-models,target=/opt/spotlight \
-p 2222:80 \
dbpedia/dbpedia-spotlight \
spotlight.sh en
@johnschimmel
johnschimmel / inTheLifeMediaSearch.php
Created Nov 7, 2011
PHP SOAP request using CURL to retrieve In The Life Station listings
View inTheLifeMediaSearch.php
<?php
function getListingsViaSoap($zipcode) {
$url = "http://www.tracmedia.com/lol/LOLService.asmx";
$soap_request = '<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<InTheLife xmlns="http://tracmedia.org/">
@johnschimmel
johnschimmel / index.html
Last active Sep 4, 2021
Demo of loading Google Maps, fetching Markers with AJAX, Geocoding new location and POSTing new location with AJAX. http://dwd-nodejs-remoteapis.herokuapp.com/
View index.html
<style>
/* IMPORTANT - must give map div height */
#map-canvas {
height:400px;
}
/* IMPORTANT - fixes webkit infoWindow rendering */
#map-canvas img {
max-width: none;
}
@johnschimmel
johnschimmel / jsonify_route.py
Created Nov 6, 2012
Sample Flask route to create JSON from Dictionary
View jsonify_route.py
from flask import jsonify
@app.route('/data/ideas')
def data_ideas():
# query for the ideas - return oldest first, limit 10
ideas = models.Idea.objects().order_by('+timestamp').limit(10)
if ideas:
@johnschimmel
johnschimmel / ffmpeg.sh
Created May 21, 2021
ffmpeg embed srt caption
View ffmpeg.sh
ffmpeg -i funtime.mp4 -f srt -i funtime.srt -c:v copy -c:a copy -c:s mov_text -metadata:s:s:0 language=eng funtime_w_captions.mp4
@johnschimmel
johnschimmel / sample_route.py
Created Oct 25, 2012
Sample of Flask receiving JSON
View sample_route.py
# If /json route receives header "application/json"
@app.route("/json", methods=['GET','POST'])
def json():
app.logger.debug("JSON received...")
app.logger.debug(request.json)
if request.json:
mydata = request.json # will be
@johnschimmel
johnschimmel / sample_route.py
Created Oct 21, 2012
Dictionary in dictionary to Jinja2 example
View sample_route.py
# put this in your app.py
@app.route("/nuts")
def nutbutter():
# nuts and review
nuttbutterReviews = {
'almond' : 'great',
'peanut' : 'okay',
'walnut' : 'what is this stuff?'
@johnschimmel
johnschimmel / server_simple.js
Created Feb 7, 2012
Simple NodeJS web server example
View server_simple.js
/************************************************
FILENAME
server_simple.js
DESCRIPTION
creates a simple web server that
display "Hello Dynamic World Wide Web"
HOW TO START SERVER:
1) from terminal run 'node simple_server.js'
@johnschimmel
johnschimmel / getFavorites.py
Last active Jan 8, 2019
Download flickr favorites
View getFavorites.py
import flickrapi
import urllib.request
import os.path
import json
# Make it work for Python 2+3 and with Unicode
import io
try:
to_unicode = unicode
except NameError:
@johnschimmel
johnschimmel / googleDocsAPI
Created Dec 22, 2011
Google Docs API + PHP + ClientLogin example
View googleDocsAPI
<?php
// Example of how to log into Google API with ClientLogin, good to use when you're not making a webapp.
// code taken and minimally updated from http://kovshenin.com/2009/10/google-docs-api-client-login-with-php-and-curl-1494/
// Construct an HTTP POST request
$clientlogin_url = "https://www.google.com/accounts/ClientLogin";
$clientlogin_post = array(
"accountType" => "HOSTED_OR_GOOGLE",
"Email" => "your@gmail.com",