To install a custom package or modify an existing docker image we need to
- run a docker a container from the image we wish to modify
- modify the docker container
- commit the changes to the container as a docker image
- test changes made to image
To install a custom package or modify an existing docker image we need to
bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:9000)" != "200" ]]; do sleep 5; done' | |
# also check https://gist.github.com/rgl/c2ba64b7e2a5a04d1eb65983995dce76 |
# overwrite master with contents of feature branch (feature > master) | |
git checkout feature # source name | |
git merge -s ours master # target name | |
git checkout master # target name | |
git merge feature # source name |
object ZipManager { | |
fun zip(files: List<File>, zipFile: File) { | |
ZipOutputStream(BufferedOutputStream(FileOutputStream(zipFile))).use { output -> | |
files.forEach { file -> | |
(file.length() > 1).ifTrue { | |
FileInputStream(file).use { input -> | |
BufferedInputStream(input).use { origin -> | |
val entry = ZipEntry(file.name.toRealName()) | |
output.putNextEntry(entry) |
Using Python to check if remote port is open and accessible.
Taken from http://snipplr.com/view/19639/test-if-an-ipport-is-open/
Usage:
#!/usr/bin/env python | |
import json | |
import sys | |
try: | |
dotenv = sys.argv[1] | |
except IndexError as e: | |
dotenv = '.env' | |
with open(dotenv, 'r') as f: |
APP_ENV=testing | |
APP_KEY=SomeRandomString | |
DB_CONNECTION=testing | |
DB_TEST_USERNAME=root | |
DB_TEST_PASSWORD= | |
CACHE_DRIVER=array | |
SESSION_DRIVER=array | |
QUEUE_DRIVER=sync |
""" This is a simple gist to show how to mock | |
private methods. I've got lots of questions | |
regarding this topic. Most people seems confused. | |
Hope it helps. | |
""" | |
import unittest | |
import mock |
import subprocess | |
try: | |
output = subprocess.check_output(['sudo', 'iwgetid']) | |
print("Connected Wifi SSID: " + output.split('"')[1]) | |
except Exception, e: | |
print e |
from wtforms import SelectField | |
import pycountry | |
class CountrySelectField(SelectField): | |
def __init__(self, *args, **kwargs): | |
super(CountrySelectField, self).__init__(*args, **kwargs) | |
self.choices = [(country.alpha_2, country.name) for country in pycountry.countries] |