Skip to content

Instantly share code, notes, and snippets.

@badri
badri / op.txt
Created May 17, 2018 05:25
Behat output
--- Failed scenarios:
features/archive/sessions.feature:80
features/discussions/privacy.feature:25
125 scenarios (100 passed, 2 failed, 23 undefined)
1255 steps (1096 passed, 2 failed, 59 undefined, 98 skipped)
15m6.36s (70.64Mb)
--- FeatureContext has missing steps. Define them with these snippets:
@badri
badri / docker-entrypoint.sh
Created April 11, 2018 14:15
MongoDB docker image init script with user provided credentials
#!/bin/bash
set -Eeuo pipefail
if [ "${1:0:1}" = '-' ]; then
set -- mongod "$@"
fi
originalArgOne="$1"
# allow the container to be started with `--user`
FROM lakshminp/node-platform:1.0
FROM postgres:lastest
FROM lakshminp/python-platform:1.0
FROM lakshminp/php-platform:1.9
@badri
badri / .gitlab-ci.yml
Created February 16, 2018 15:36
Gitlab CI behat
image: tetraweb/php:7.1
services:
- mariadb:latest
variables:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: drupal
MYSQL_USER: drupal
MYSQL_PASSWORD: drupal
@badri
badri / cbv_multiple_forms.html
Created January 18, 2018 04:03
Django multiple forms code with sample usage
{% extends "base.html" %}
{% block content %}
<form method="post">{% csrf_token %}
{{ forms.subscription }}
<input type="submit" value="Subscribe">
</form>
<form method="post">{% csrf_token %}
{{ forms.contact }}
<input type="submit" value="Send">
@badri
badri / pre-commit
Created December 5, 2017 06:40
pre-commit for preventing unencrypted secrets from getting committed
#!/bin/bash
#
# This pre-commit hook checks that you havn't left and DONOTCOMMIT tokens in
# your code when you go to commit.
#
# To use this script copy it to .git/hooks/pre-commit and make it executable.
#
# This is provided just as an example of how to use a pre-commit hook to
# catch nasties in your code.
@badri
badri / gist:a90149e2089042781039cfc3a6daf447
Created December 4, 2017 10:08
Django secret key generation script
python -c "import string,random; uni=string.ascii_letters+string.digits+string.punctuation; print repr(''.join([random.SystemRandom().choice(uni) for i in range(random.randint(45,50))]))"