Populating this as we dig further into the platform, hopefully it'll be as useful to you as it is to use.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -o errexit | |
set -o nounset | |
TEMPDIR=$(mktemp -d) | |
prefix="[vault-check]" | |
zero_commit="0000000000000000000000000000000000000000" | |
bad_file=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Copyright (C) 2021 Pascal de Vink (Tweakers.net) | |
This library is free software; you can redistribute it and/or | |
modify it under the terms of the GNU Lesser General Public | |
License as published by the Free Software Foundation; either | |
version 2.1 of the License, or (at your option) any later version. | |
This library is distributed in the hope that it will be useful, | |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# roles when | |
roles: | |
- { role: main, when: inventory_file|basename == 'inventory' } | |
# WSL connection bug | |
# https://stackoverflow.com/questions/62363901/ansible-msg-failed-to-create-temporary-directory-in-some-cases-fatal | |
mv /usr/bin/sleep /usr/bin/sleep.dist | |
ln -s /bin/true /usr/bin/sleep | |
# Run locally |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import io | |
import pymongo | |
import psycopg2 | |
import gridfs | |
import timeit | |
# For fairness use the same chunk size - 512k. | |
CHUNK_SIZE = 1024 * 512 | |
def bench_mongo(fs, size): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// keepDoingSomething will keep trying to doSomething() until either | |
// we get a result from doSomething() or the timeout expires | |
func keepDoingSomething() (bool, error) { | |
timeout := time.After(5 * time.Second) | |
tick := time.Tick(500 * time.Millisecond) | |
// Keep trying until we're timed out or got a result or got an error | |
for { | |
select { | |
// Got a timeout! fail with a timeout error | |
case <-timeout: |
How to setup a development environment where Git from WSL integrates with native Windows applications, using the Windows home folder as the WSL home and using Git from WSL for all tools.
Note if using Git for Windows, or any tool on the Windows side that does not use Git from WSL then there will likely be problems with file permissions if using those files from inside WSL.
These are the tools I use:
- git (wsl) - Command line git from within WSL.
- Fork (windows) - Git GUI (must be used with
wslgit
) - wslgit - Makes git from WSL available for Windows applications. Important! Follow the installation instructions and do (at least) the first optional step and then the Usage in Fork instructions.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Pre-commit hook that verifies if all files containing 'vault' in the name | |
# are encrypted. | |
# If not, commit will fail with an error message | |
# | |
# Original author: @ralovely | |
# https://www.reinteractive.net/posts/167-ansible-real-life-good-practices | |
# | |
# File should be .git/hooks/pre-commit and executable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Example for the Docker Hub V2 API | |
# Returns all images and tags associated with a Docker Hub organization account. | |
# Requires 'jq': https://stedolan.github.io/jq/ | |
# set username, password, and organization | |
UNAME="" | |
UPASS="" | |
ORG="" |
https://gist.github.com/dancheskus/365e9bc49a73908302af19882a86ce52
В результате будет 2 react проекта на 1 сервере доступных по разным ссылкам
OlderNewer