Skip to content

Instantly share code, notes, and snippets.

View camilb's full-sized avatar
🗻
remote

Camil Blanaru camilb

🗻
remote
View GitHub Profile
@camilb
camilb / nginx.conf
Created March 21, 2024 23:53 — forked from ansulev/nginx.conf
Ultimate nginx configuration for improved security and performance.
#
# /etc/nginx/nginx.conf
#
user http;
worker_processes 1;
worker_priority -10;
worker_rlimit_nofile 260000;
timer_resolution 100ms;
@camilb
camilb / DOCKERFILE
Created August 10, 2023 20:36 — forked from MatthewJamesBoyle/DOCKERFILE
production go dockerfile
FROM golang:1.21.0-bullseye as builder
COPY . /workdir
WORKDIR /workdir
ENV CGO_CPPFLAGS="-D_FORTIFY_SOURCE=2 -fstack-protector-all"
ENV GOFLAGS="-buildmode=pie"
RUN go build -ldflags "-s -w" -trimpath ./cmd/app
@camilb
camilb / laravel-fastcgi-cache-config.md
Created April 18, 2023 20:20 — forked from murdercode/laravel-fastcgi-cache-config.md
Optimizing Laravel (and Nova) with FastCGI Cache Configuration

Laravel + FastCGI Cache = ❤️

Using FastCGI cache allows you to speed up your website up to 1000x. In fact, the FastCGI cache (or Varnish) mechanism consists of putting a server-caching mechanism between a client and your web server. The whole page will be cached as an HTML output, and it will be delivered instead of using the PHP/MySQL/Redis stack, etc. for all users, but only for the first visit (and others after some specified time).

WARNING: This is not a take-away how-to. Please read it carefully and use it at your own risk.

This config is based on the ploi.io stack. We will not cover the FastCGI installation process, so please prepare FastCGI and adapt the next config if you need it.

What you need to know

@camilb
camilb / cli53_import_zone_file.md
Created August 24, 2022 15:20 — forked from pgchamberlin/cli53_import_zone_file.md
Replace a zone file to AWS Route53 using cli53

Replace a zone file in AWS Route53 using cli53

cli53 is a command line tool for Amazon Route53 and it's well documented.

Basic syntax to replace a BIND zone file is very simple:

cli53 import --file zonefile.txt --replace example.com
@camilb
camilb / upload-tls-from-k8s-secrets-list.sh
Created April 24, 2020 11:58
Send curl POST requests containing TLS certificates from a list of Kubernetes secrets
#!/usr/bin/env bash
while read DOMAIN; do
echo "getting certificate for $DOMAIN"
CERT=$(kubectl get secret $DOMAIN -o "jsonpath={.data['tls\.crt']}" | base64 --decode | awk 'NF {sub(/\r/, ""); printf "%s\\n",$0;}')
KEY=$(kubectl get secret $DOMAIN -o "jsonpath={.data['tls\.key']}" | base64 --decode | awk 'NF {sub(/\r/, ""); printf "%s\\n",$0;}')
echo "Uploading certificate for $DOMAIN"
curl -X POST -u 'user:pass' --header "Content-Type: application/json" --header "Accept: application/json" "https://some-api.example.com/api/v1/host/$DOMAIN" -d "{
@camilb
camilb / aws_eks_config
Created October 9, 2019 06:37 — forked from tobemedia/aws_eks_config
EKS DNS Workaround
# file: aws_eks_config.yml
# AWS EKS ClusterConfig used to setup the BinderHub / JupyterNotebooks K8s cluster
# using a workaround from https://discourse.jupyter.org/t/binder-deployed-in-aws-eks-domain-name-resolution-errors/766/10
# to fix broken DNS resolution
---
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
name: eks-dns-production
@camilb
camilb / gpg-signing.md
Created January 26, 2019 10:10 — forked from Shinrai/gpg-signing.md
Setup GPG with only Git installed (Windows)

Preface

This gist will walk you through on how to setup GPG signing automatically through git on windows

If you have GNUPG or GPG4WIN installed you will need to uninstall them prior to following this gist.

Step 1

Locate gpg.exe {GPGBIN} {GPGBINFOLDER}

Git ONLY

Open a command line shell

@camilb
camilb / postgres_queries_and_commands.sql
Created June 6, 2018 09:49 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@camilb
camilb / _readme.md
Created June 5, 2018 18:31 — forked from pongstr/_readme.md
HTTP/2 Recipe: Nginx + Node.js

Imgur

Recipe

Install homebrew/services, this will be helpful, you'll see later. :D

$ brew tap homebrew/services 
@camilb
camilb / k8s-svc-annotations.md
Created April 10, 2018 13:50 — forked from mgoodness/k8s-svc-annotations.md
AWS ELB-related annotations for Kubernetes Services (v1.5)
  • service.beta.kubernetes.io/aws-load-balancer-access-log-emit-interval (in minutes)
  • service.beta.kubernetes.io/aws-load-balancer-access-log-enabled (true|false)
  • service.beta.kubernetes.io/aws-load-balancer-access-log-s3-bucket-name
  • service.beta.kubernetes.io/aws-load-balancer-access-log-s3-bucket-prefix
  • service.beta.kubernetes.io/aws-load-balancer-backend-protocol (http|https|ssl|tcp)
  • service.beta.kubernetes.io/aws-load-balancer-connection-draining-enabled (true|false)
  • service.beta.kubernetes.io/aws-load-balancer-connection-draining-timeout (in seconds)