Skip to content

Instantly share code, notes, and snippets.

Avatar

Julien Breux JulienBreux

View GitHub Profile
@JulienBreux
JulienBreux / aliases.sh
Last active Aug 14, 2021
Kubernetes term aliases
View aliases.sh
# Used to run minikube shortly
alias mk="minikube"
# Used to run kubectl shortly
alias k="kubectl"
# Used to get ...
alias kg="kubectl get"
# Used to get all pods
@JulienBreux
JulienBreux / BlockTags.php
Created Apr 2, 2012
PrestaShop 1.5.x - Module override in themes
View BlockTags.php
<?php
/**
* Example of override of Block Tags module
*
* @version 1.0.0
* @author Julien BREUX <julien.breux@prestashop.com>
*/
class BlockTagsTheme extends BlockTags
{
//...
@JulienBreux
JulienBreux / CKA.md
Last active Jul 1, 2021
CKA-07-2021 - Certification Kubernetes Administrator
View CKA.md

JSON Path

Get restart count from container name

$.status.containerStatuses[?(@.name == 'xxx-container')].restartCount

Print node addresses

$.items[*].status.addresses[?(@.type=="InternalIP")].address
@JulienBreux
JulienBreux / go1.16-golang.md
Created Feb 20, 2021
How to get Go (golang) 1.16 without wasting time
View go1.16-golang.md

How to get Go (golang) 1.16 without wasting time

go get golang.org/dl/go1.16
go1.16 download
go1.16 version
@JulienBreux
JulienBreux / Dockerfile
Created Feb 10, 2015
Docker + Rails + Redis + Postgres
View Dockerfile
# base on latest ruby base image
FROM ruby:latest
# update and install dependencies
RUN apt-get update -qq
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential libpq-dev nodejs apt-utils postgresql-client
# setup app folders
RUN mkdir /sample
WORKDIR /sample
@JulienBreux
JulienBreux / read-access.sql
Last active Feb 18, 2020 — forked from oinopion/read-access.sql
How to create read only user in PostgreSQL
View read-access.sql
-- Create a group
CREATE ROLE readaccess;
-- Grant access to existing tables
GRANT CONNECT ON DATABASE _database_name_ TO readaccess;
GRANT USAGE ON SCHEMA public TO readaccess;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess;
GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public TO readaccess;
-- Grant access to future tables
View gist:7dea5c890dd39454ec61be05a99aa1e7
minikube_initialized=$(minikube profile list -o json | jq 'select(.valid != null) | .valid | map(select(.Name == "minikube")) | length')
View circle-tag.sh
TAG=$(echo ${CIRCLE_SHA1} | cut -c1-7)
if [ ! -z "${CIRCLE_TAG}" ]; then
TAG="${CIRCLE_TAG}"
fi
@JulienBreux
JulienBreux / Dockerfile
Created Aug 19, 2019
Speed Nginx Docker (for tests)
View Dockerfile
FROM nginx:1-alpine
COPY ./src/index.html /usr/share/nginx/html
COPY ./etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf
@JulienBreux
JulienBreux / index-mgd.go
Created Apr 16, 2019
mgo vs mongo-go-driver
View index-mgd.go
import (
"go.mongodb.org/mongo-driver/mongo"
mongooptions "go.mongodb.org/mongo-driver/mongo/options"
)
// createSlugIndex creates the slug index in Mongo collection
func createSlugIndex(ctx context.Context, c mongo.Collection) (err error) {
ptrTrue := true
ptrSlug := "slug"
_, err = c.Indexes().CreateMany(ctx, []mongo.IndexModel{