Skip to content

Instantly share code, notes, and snippets.

View miohtama's full-sized avatar
🏠
https://tradingstrategy.ai

Mikko Ohtamaa miohtama

🏠
https://tradingstrategy.ai
View GitHub Profile
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<body>
<div id="myDiv" oncontextmenu="return false"></div>
<script>
var d3 = Plotly.d3,
N = 1000,
y = d3.range(N).map(d3.random.normal()),
data = [{y: y}]
@phuysmans
phuysmans / gist:4f67a7fa1b0c6809a86f014694ac6c3a
Created January 8, 2018 09:29
docker compose health check example
version: '2.1'
services:
php:
tty: true
build:
context: .
dockerfile: tests/Docker/Dockerfile-PHP
args:
version: cli
volumes:
@giannisp
giannisp / gist:ebaca117ac9e44231421f04e7796d5ca
Last active March 1, 2024 14:39
Upgrade PostgreSQL 9.6.5 to 10.0 using Homebrew (macOS)
After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work.
The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0."
Database files have to be updated before starting the server, here are the steps that had to be followed:
# need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default
brew unlink postgresql
brew install postgresql@9.6
brew unlink postgresql@9.6
brew link postgresql
@luhn
luhn / traversal_paths.py
Created April 12, 2017 00:25
URL traversal sitemap
"""
Inspect a Pyramid app using URL traversal and construct URLs for all the views.
"""
def get_resources(self, root):
resources = {
type(root): root,
}
for resource in root.values():
resources.update(self.get_resources(resource))
@benselme
benselme / tree.py
Last active May 28, 2022 18:19
SQLAlchemy ordered tree with postgresql recursive CTE
# -*- encoding: utf-8 -*-
from sqlalchemy import (Column, Integer, ForeignKey, String, create_engine,
literal, null, type_coerce)
from sqlalchemy.dialects.postgresql import array, ARRAY
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import Session, aliased
Base = declarative_base()
@cedbeu
cedbeu / webapp.py
Created May 17, 2013 00:25
Minimal Flask application - Basic single-file design pattern
#!/usr/bin/python
# coding: utf-8
from flask import Flask
app = Flask(__name__)
@app.route('/')
def entry_point():
return 'Hello World!'