Dump existing data:
python3 manage.py dumpdata > datadump.json
Change settings.py to Postgres backend.
Make sure you can connect on PostgreSQL. Then:
from collections import Counter | |
def solve_1(s, k): | |
# the one i came up with | |
chars = Counter() | |
start = 0 | |
ans = '' | |
ans_len = float('-inf') |
upstream app_server { | |
server unix:/home/daniel/run/gunicorn.sock fail_timeout=0; | |
} | |
server { | |
listen 80; | |
root /home/daniel/voting_app/client/build; | |
server_name <your_server_ip>; | |
index index.html index.htm; |
// library class, 2 methods | |
// find book details by ISBN | |
// find book by title | |
// can add more metadata later | |
function Book(title, author, isbn){ | |
this.title = title; | |
this.author = author; | |
this.isbn = isbn; |
'use strict'; | |
// testing out minimax algorithm on node first before adding it to client side | |
/* | |
a recursize algorithm | |
base cases are end states | |
1 for a win, 0 for a draw and -1 for a loss | |
recursive steps |
import os | |
from flask import Flask, request, redirect, url_for | |
from werkzeug import secure_filename | |
#create this folder structure, static/uploads | |
UPLOAD_FOLDER = './static/uploads/' | |
ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif']) | |
app = Flask(__name__) | |
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER |
function sym(args) { | |
//solution with ES6 | |
//instead of doing manual work, make set operations | |
//combine values | |
var union = (set1, set2) => new Set([...set1, ...set2]); | |
//Common values, set1 values, if set2 has them, keep them | |
var intersection = (set1, set2) => new Set( [...set1].filter(value => set2.has(value)) ); | |
//keep values that are found only in set1 |
#table formatting example | |
# lists to create table | |
header = ['First name', 'Last name'] | |
first = ['Daniel', 'Ronnie', 'Vanessa'] | |
last = ['Chia', 'Hernandez', 'Luka'] | |
# define variables | |
col_count = 2 | |
col_widths = [10, 9] |
#set -g default-terminal "screen-256color" | |
#prefit to ctrl+a | |
unbind C-b | |
set -g prefix C-a | |
# easy-to-remember split pane commands | |
bind | split-window -h -c "#{pane_current_path}" | |
bind - split-window -v -c "#{pane_current_path}" | |
bind c new-window -c "#{pane_current_path}" |