Let's imagine a very simple table
CREATE TABLE people {
id bigserial,
name character varying
}| package main | |
| import ( | |
| "net/http" | |
| "database/sql" | |
| "fmt" | |
| "log" | |
| "os" | |
| ) |
| def add_cors_headers(response): | |
| response.headers['Access-Control-Allow-Origin'] = '*' | |
| if request.method == 'OPTIONS': | |
| response.headers['Access-Control-Allow-Methods'] = 'DELETE, GET, POST, PUT' | |
| headers = request.headers.get('Access-Control-Request-Headers') | |
| if headers: | |
| response.headers['Access-Control-Allow-Headers'] = headers | |
| return response | |
| app.after_request(add_cors_headers) |
| // Use Case: | |
| // | |
| // Say you have a bunch of decoupled components which access the same set of databases. | |
| // Since database/sql does connection pooling it makes sense for the components to share instances of *sql.DB | |
| // This package lets you do that with minimal code changes. | |
| package dbmanager | |
| import ( | |
| "database/sql" | |
| "time" |
| upstream myapp { | |
| server 127.0.0.1:8081; | |
| } | |
| limit_req_zone $binary_remote_addr zone=login:10m rate=1r/s; | |
| server { | |
| listen 443 ssl spdy; | |
| server_name _; | |
| ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key | |
| # Don't add passphrase | |
| openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub | |
| cat jwtRS256.key | |
| cat jwtRS256.key.pub |
Hello software developers,
Please check your code to ensure you're not making one of the following mistakes related to cryptography.
| #!/usr/bin/env python3 | |
| import requests | |
| from flask import * | |
| import random | |
| from apscheduler.schedulers.background import BackgroundScheduler | |
| app = Flask(__name__) | |
| scheduler = BackgroundScheduler() | |
| url = "https://reddit.com/r/gonewild/comments.json?limit=200" |
| server { | |
| .... | |
| location ~ ^/x/(.*) { | |
| if ($args = "go-get=1") { | |
| add_header Content-Type text/html; | |
| return 200 '<meta name="go-import" content="$host/x/$1 git https://github.com/jessfraz/$1.git">'; | |
| } | |
| return 302 https://github.com/jessfraz/$1; | |
| } |
| import com.squareup.moshi.Json | |
| import com.squareup.moshi.KotlinJsonAdapterFactory | |
| import com.squareup.moshi.Moshi | |
| import com.squareup.moshi.Rfc3339DateJsonAdapter | |
| import java.util.Date | |
| val json = """ | |
| { | |
| "url": "https://api.github.com/repos/square/okio/issues/156", | |
| "id": 91393390, |