Helper setup to edit .yaml files with Vim:
List of general purpose commands for Kubernetes management:
| #!/bin/bash -e | |
| # Usage ./k8s-service-account-kubeconfig.sh ( namespace ) ( service account name ) | |
| TEMPDIR=$( mktemp -d ) | |
| trap "{ rm -rf $TEMPDIR ; exit 255; }" EXIT | |
| SA_SECRET=$( kubectl get sa -n $1 $2 -o jsonpath='{.secrets[0].name}' ) |
Helper setup to edit .yaml files with Vim:
List of general purpose commands for Kubernetes management:
| # import config. | |
| # You can change the default config with `make cnf="config_special.env" build` | |
| cnf ?= config.env | |
| include $(cnf) | |
| export $(shell sed 's/=.*//' $(cnf)) | |
| # import deploy config | |
| # You can change the default deploy config with `make cnf="deploy_special.env" release` | |
| dpl ?= deploy.env | |
| include $(dpl) |
| get_latest_release() { | |
| curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api | |
| grep '"tag_name":' | # Get tag line | |
| sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value | |
| } | |
| # Usage | |
| # $ get_latest_release "creationix/nvm" | |
| # v0.31.4 |
| package main | |
| import ( | |
| "crypto/rand" | |
| "flag" | |
| "log" | |
| mrand "math/rand" | |
| "net" | |
| "os" | |
| "os/signal" |
| (function () { | |
| function c() { | |
| var e = document.createElement("link"); | |
| e.setAttribute("type", "text/css"); | |
| e.setAttribute("rel", "stylesheet"); | |
| e.setAttribute("href", f); | |
| e.setAttribute("class", l); | |
| document.body.appendChild(e) | |
| } | |
| function h() { |
| import uuid | |
| import wtforms_json | |
| from sqlalchemy import not_ | |
| from sqlalchemy.dialects.postgresql import UUID | |
| from wtforms import Form | |
| from wtforms.fields import FormField, FieldList | |
| from wtforms.validators import Length | |
| from flask import current_app as app | |
| from flask import request, json, jsonify, abort |
| user www-data; | |
| worker_processes 4; | |
| error_log /var/log/nginx/error.log; | |
| pid /var/run/nginx.pid; | |
| events { | |
| worker_connections 1024; | |
| } |
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| __author__ = "Adrien Pujol - http://www.crashdump.fr/" | |
| __copyright__ = "Copyright 2013, Adrien Pujol" | |
| __license__ = "Mozilla Public License" | |
| __version__ = "0.3" | |
| __email__ = "[email protected]" | |
| __status__ = "Development" | |
| __doc__ = "Check a TLS certificate validity." |
| import cv2.cv as cv | |
| import tesseract | |
| gray = cv.LoadImage('captcha.jpeg', cv.CV_LOAD_IMAGE_GRAYSCALE) | |
| cv.Threshold(gray, gray, 231, 255, cv.CV_THRESH_BINARY) | |
| api = tesseract.TessBaseAPI() | |
| api.Init(".","eng",tesseract.OEM_DEFAULT) | |
| api.SetVariable("tessedit_char_whitelist", "0123456789abcdefghijklmnopqrstuvwxyz") | |
| api.SetPageSegMode(tesseract.PSM_SINGLE_WORD) | |
| tesseract.SetCvImage(gray,api) | |
| print api.GetUTF8Text() |