Using JSON in Postgres by example.
- Download and install: Docker Toolbox
- Open Docker Quickstart Terminal
- Start a new postgres container:
docker run --name my-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres
| var connectionString = 'postgres://localhost:5432/postgres'; | |
| var Promise=require('bluebird'); | |
| var knex = require('knex')({ | |
| client: 'pg', | |
| connection: { | |
| user: 'postgres', | |
| database: 'postgres', | |
| port: 5432, |
Using JSON in Postgres by example.
docker run --name my-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres| // Redux actions using TypeScript discriminated unions | |
| // | |
| // Source: https://github.com/rjz/typescript-react-redux/ | |
| // Actions | |
| export type Action = | |
| { type: 'INCREMENT_COUNTER', delta: number } | |
| | { type: 'RESET_COUNTER' } |
Running in Datasette at https://vice-police-shootings.now.sh/vice-bc7c892/ViceNews_FullOISData
Here's what I did:
First, I exported as CSV the data from https://docs.google.com/spreadsheets/d/1CaOQ7FUYsGFCHEqGzA2hlfj69sx3GE9GoJ40OcqI9KY/edit#gid=1271324584
Then I converted it to a SQLite database using https://github.com/simonw/csvs-to-sqlite like so:
csvs-to-sqlite ~/Downloads/ViceNews_FullOISData.csv /tmp/vice.db \
-c Fatal -c SubjectArmed -c SubjectRace -c SubjectGender -c OfficerRace \
I bundled these up into groups and wrote some thoughts about why I ask them!
If these helped you, I'd love to hear about it!! I'm on twitter @vcarl_ or send me an email carl.vitullo@gmail.com
https://blog.vcarl.com/interview-questions-onboarding-workplace/
| """ | |
| This script processes conversation data from a JSON file, extracts messages, | |
| and writes them to text files. It also creates a summary JSON file with a summary | |
| of the conversations. The script is designed to be run as a command-line interface (CLI), | |
| allowing the user to specify the input JSON file and output directory. | |
| Usage: | |
| python script_name.py /path/to/conversations.json /path/to/output_directory | |
| """ |