Skip to content

Instantly share code, notes, and snippets.

Avatar

James Deucker bitwisecook

  • London, United Kingdom
View GitHub Profile
@bitwisecook
bitwisecook / mssql-to-sqlite.sed
Last active Dec 31, 2018
A set of regex to help transform a schema / data export from MS SQL Server to sqlite
View mssql-to-sqlite.sed
# 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?/, /
View Makefile
# 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))
View app_uwsgi.service.j2
[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 Aug 10, 2017
uWSGI INI template for nginx+uWSGI+flask
View app_uwsgi.ini.j2
[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 Aug 10, 2017
nginx.conf Jinja template for ngnix+uWSGI+flask app
View app-nginx.conf.j2
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 Aug 10, 2017
Ansible playbook for nginx+uWSGI+flask
View www.yml
---
- hosts: [www]
tasks:
- name: update apk
apk:
update_cache: yes
- name: upgrade alpine
apk:
upgrade: yes
tags: