Skip to content

Instantly share code, notes, and snippets.

View bitwisecook's full-sized avatar

James Deucker bitwisecook

  • London, United Kingdom
View GitHub Profile
@bitwisecook
bitwisecook / mssql-to-sqlite.sed
Last active December 31, 2018 12:13
A set of regex to help transform a schema / data export from MS SQL Server to sqlite
# schema.sql transforms
s/\[n?(var)?char\]\((max|\d+)\)/TEXT/
s/\[(small|big|tiny)?int\]/INTEGER/
s/\[bit\]/BOOLEAN/
s/\[datetime\]/DATETIME/
s/\[(var)?binary\]\((max|\d+)\)/BLOB/
s/^\t\[([^\]]+)\]/\t\1/
s/IDENTITY\(\d+,\d+\) //
s/CONSTRAINT \[[^\]]+\] PRIMARY KEY CLUSTERED \n\(([^\)]+)\)/PRIMARY KEY (\1) /
s/ ASC,?\n\t?/, /
# Be aware to first setup a valid Python 3 environment with the proper requirements installed.
# Also activate your Python installation/venv before executing those commands.
VER=0.19.4
PROGS?=app1 app2 app3 app4
PROGS_PY:=$(addsuffix .py,$(PROGS))
PROGS_EXE:=$(addsuffix .exe,$(PROGS))
[Unit]
Description=uWSGI instance to serve app
After=network.target
[Service]
{# ExecStartPre=/bin/mkdir -p /run/uwsgi #}
{# ExecStartPre=/bin/chown www-data:www-data /run/uwsgi #}
User=root
Group=root
WorkingDirectory=/var/www/app
@bitwisecook
bitwisecook / app_uwsgi.ini.j2
Created August 10, 2017 12:36
uWSGI INI template for nginx+uWSGI+flask
[uwsgi]
# application's base folder
appname = app
base = /var/www/app
# python module to import
app = app
module = %(app)
chdir = %(base)
@bitwisecook
bitwisecook / app-nginx.conf.j2
Created August 10, 2017 12:34
nginx.conf Jinja template for ngnix+uWSGI+flask app
server {
listen 80;
server_name {{ ansible_host }};
charset utf-8;
client_max_body_size 75M;
location / { try_files $uri @app; }
location @app {
include uwsgi_params;
uwsgi_pass unix:/run/uwsgi/app/app/socket;
@bitwisecook
bitwisecook / www.yml
Created August 10, 2017 12:32
Ansible playbook for nginx+uWSGI+flask
---
- hosts: [www]
tasks:
- name: update apk
apk:
update_cache: yes
- name: upgrade alpine
apk:
upgrade: yes
tags: