Skip to content

Instantly share code, notes, and snippets.

View datashaman's full-sized avatar

datashaman datashaman

  • datashaman
  • Cape Town, South Africa
View GitHub Profile
@datashaman
datashaman / README.md
Last active December 15, 2017 09:42
SQLite3 migrate by create and copy #SQLite #migrations

SQLite3 migrate by create and copy

  • Place the source DB into data/old.db.
  • Ensure your local DB (the one used for development) is up-to-date.
  • Add the list of models and tables in dependent order.
  • Add your own defaults for columns that are required but have no source data.
  • Run the command, fix any problems.
  • The db in data/new.db will have the latest schema and workable current data.

This does not need Flask to be used. It could be adapted for general use with SQLAlchemy only.

@datashaman
datashaman / build.sh
Created December 15, 2017 09:46
build and deploy from a wheel archive
#!/usr/bin/env bash
tempdir=$(mktemp -d /tmp/wheel-XXXXX)
pip wheel -r requirements.txt --wheel-dir=$tempdir
BUILD_HOME=${BUILD_HOME:-$(pwd)/build}
BUILD_FILE=${BUILD_FILE:-build}
mkdir -p "$BUILD_HOME"
(cd "$tempdir"; tar -czvf "$BUILD_HOME/$BUILD_FILE.tgz" *)
#!/usr/bin/env bash
#
# Lives here: https://gist.github.com/datashaman/0dd6d294c68a16181141d9c41285e9fb
#
# Refresh your working copy branches. Assumes that you have a source
# repository on _origin_ remote, and a fork on _$GIT_REFRESH_REMOTE_ remote.
#
# Required .env variables:
# GIT_REFRESH_REMOTE - set to the remote name for your fork.
#
@datashaman
datashaman / Datashaman\PHPCheck\choose Example
Last active April 28, 2019 19:24
Datashaman\PHPCheck\choose Example
<?php
<<<CONFIG
packages:
- "datashaman/phpcheck: dev-wip"
CONFIG;
#
# This is a Melody script. http://melody.sensiolabs.org/
#
use function Datashaman\PHPCheck\choose;
use function Datashaman\PHPCheck\sample;
@datashaman
datashaman / Datashaman\PHPCheck\app Example
Last active April 28, 2019 12:29
Datashaman\PHPCheck\app Example
<?php
<<<CONFIG
packages:
- "datashaman/phpcheck: dev-wip"
CONFIG;
#
# This is a Melody script. http://melody.sensiolabs.org/
#
use function Datashaman\PHPCheck\app;
@datashaman
datashaman / Datashaman\PHPCheck\makeGen Example
Last active April 28, 2019 12:31
Datashaman\PHPCheck\makeGen Example
<?php
<<<CONFIG
packages:
- "datashaman/phpcheck: dev-wip"
CONFIG;
#
# This is a Melody script. http://melody.sensiolabs.org/
#
use function Datashaman\PHPCheck\generate;
use function Datashaman\PHPCheck\makeGen;
@datashaman
datashaman / Datashaman\PHPCheck\generate Example
Last active April 28, 2019 12:25
Datashaman\PHPCheck\generate Example
<?php
<<<CONFIG
packages:
- "datashaman/phpcheck: dev-wip"
CONFIG;
#
# This is a Melody script. http://melody.sensiolabs.org/
#
use function Datashaman\PHPCheck\ascii;
use function Datashaman\PHPCheck\generate;
@datashaman
datashaman / Datashaman\PHPCheck\arguments Example
Last active April 28, 2019 12:25
Datashaman\PHPCheck\arguments Example
<?php
<<<CONFIG
packages:
- "datashaman/phpcheck: dev-wip"
CONFIG;
#
# This is a Melody script. http://melody.sensiolabs.org/
#
use function Datashaman\PHPCheck\arguments;
use function Datashaman\PHPCheck\generate;
@datashaman
datashaman / Datashaman\PHPCheck\arrays Example
Last active April 28, 2019 12:25
Datashaman\PHPCheck\arrays Example
<?php
<<<CONFIG
packages:
- "datashaman/phpcheck: dev-wip"
CONFIG;
#
# This is a Melody script. http://melody.sensiolabs.org/
#
use function Datashaman\PHPCheck\arrays;
use function Datashaman\PHPCheck\generate;
@datashaman
datashaman / Datashaman\PHPCheck\ascii Example
Last active April 28, 2019 19:24
Datashaman\PHPCheck\ascii Example
<?php
<<<CONFIG
packages:
- "datashaman/phpcheck: dev-wip"
CONFIG;
#
# This is a Melody script. http://melody.sensiolabs.org/
#
use function Datashaman\PHPCheck\ascii;
use function Datashaman\PHPCheck\sample;