# Install pipenv
pip install pipenv
# Create Venv
pipenv shell
from __future__ import print_function # Python 2/3 compatibility | |
import boto3 | |
import json | |
import decimal | |
from boto3.dynamodb.conditions import Key, Attr | |
# Helper class to convert a DynamoDB item to JSON. | |
class DecimalEncoder(json.JSONEncoder): | |
def default(self, o): | |
if isinstance(o, decimal.Decimal): |
version: '2' | |
services: | |
redis: | |
image: redis:alpine | |
container_name: redis_db | |
command: redis-server --appendonly yes | |
ports: | |
- 6379:6379 | |
volumes: |
- Find an API that supplies the data. | |
- I found the one that MarineTraffic.com uses (http://www.marinetraffic.com) | |
- Open your computer's terminal, and paste this: | |
curl 'http://www.marinetraffic.com/ais/getjson.aspx?sw_x=0&sw_y=70&ne_x=30&ne_y=80&zoom=6&fleet=&station=0&id=null' -H 'Referer: http://www.marinetraffic.com/ais/' | |
- This shows you all the data. You will now need to automate calling this API | |
- Get the data from the API using something like jQuery: | |
- Documentation: http://api.jquery.com/jQuery.getJSON/ | |
- Tutorial :http://www.youtube.com/watch?v=3hN4PrJ7R6A |
class Solution(object): | |
def lengthOfLongestSubstring(self, string: str) -> int: | |
sub = {} | |
cur_sub_start = 0 | |
cur_len = 0 | |
longest = 0 | |
for i, letter in enumerate(string): | |
if letter in sub and sub[letter] >= cur_sub_start: | |
cur_sub_start = sub[letter] + 1 |
<?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/"> |
psql -U postgres
Some interesting flags (to see all, use -h
or --help
depending on your psql version):
-E
: will describe the underlaying queries of the \
commands (cool for learning!)-l
: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)Software required:
After installation and putting the youtube-dl
in PATH
youtube-dl \