Skip to content

Instantly share code, notes, and snippets.

View texano00's full-sized avatar
🏠
Working from home

Yuri texano00

🏠
Working from home
View GitHub Profile
@texano00
texano00 / main.py
Last active July 28, 2023 20:49
copy a container image from source to target using standard Docker API v2
import requests
import sys
# Copy a source image to a target repository using Docker API registry v2
# ref. https://www.yuribacciarini.com/docker-registry-http-api-v2-demistified-once-and-for-all/
def main():
source = "gcr.io/google-containers/addon-builder:latest"
target = "ZZZ.dkr.ecr.us-east-1.amazonaws.com/addon-builder:latest"
apiVersion: v1
kind: apiVersion: v1
kind: Pod
metadata:
name: ambassadro-sample
spec:
containers:
- name: twemproxy
image: ganomede/twemproxy
command:
apiVersion: v1
kind: apiVersion: v1
kind: Pod
metadata:
name: ambassadro-sample
spec:
containers:
- name: twemproxy
image: ganomede/twemproxy
command:
redis:
listen: 127.0.0.1:6379
hash: fnv1a_64
distribution: ketama
auto_eject_hosts: true
redis: true
timeout: 400
server_retry_timeout: 2000
server_failure_limit: 1
servers:
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: sharded-redis
spec:
serviceName: "redis"
replicas: 3
template:
metadata:
labels:
@texano00
texano00 / dispatch.ts
Last active November 8, 2018 12:51
NgRx example of dispatching
@Component({
selector: 'films',
template: `
<div class="content">
<button (click)="getFilms()">Get Films</button>
<ul>
<li *ngFor="let film of films$ | async" >{{film.name}}</li>
</ul>
</div>
`,
@texano00
texano00 / nginx.conf
Created October 25, 2018 16:54
docker NGINX reverse proxy
worker_processes 2;
pid /var/run/nginx.pid;
worker_rlimit_nofile 65535;
# [ debug | info | notice | warn | error | crit ]
error_log /var/log/nginx.error_log info;
@texano00
texano00 / docker-compose.yml
Created October 25, 2018 16:49
Docker compose for nginx
version: '3'
services:
nginx:
image: nginx:latest
container_name: nginx
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
#- ./.htpasswd:/etc/nginx/.htpasswd
- ./certs:/etc/nginx/certs
@texano00
texano00 / wp-config.php
Created October 25, 2018 16:44
5b976caaf7da7000015ab52e
/**
* For WordPress, force the protocol scheme to be HTTPS
* when is_ssl() doesn't work, e.g. on a reverse proxied server
* where _SERVER['HTTPS'] and _SERVER['SERVER_PORT'] don't
* indicate that SSL is being used.
*/if ($_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https')
$_SERVER['HTTPS'] = '1';
if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) {
$_SERVER['HTTP_HOST'] = $_SERVER['HTTP_X_FORWARDED_HOST'];
@texano00
texano00 / php.conf.uploads.ini
Last active October 25, 2018 16:32
5b976caaf7da7000015ab52e
file_uploads = On
max_execution_time = 600
memory_limit = 512M
post_max_size = 32M
upload_max_filesize = 32M