Skip to content

Instantly share code, notes, and snippets.

View camilb's full-sized avatar
🗻
remote

Camil Blanaru camilb

🗻
remote
View GitHub Profile
@samdark
samdark / how_php_environment_variables_actually_work.md
Last active January 5, 2024 07:15
How PHP Environment Variables Actually work
@murdercode
murdercode / laravel-fastcgi-cache-config.md
Last active July 3, 2024 10:19
Optimizing Laravel (and Nova) with FastCGI Cache Configuration

Laravel + FastCGI Cache = ❤️

⚠️ Need a more specific guide? See https://medium.com/@murdercode/speed-up-your-laravel-application-up-to-1000x-with-fastcgi-cache-0135b11407e5

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.

@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
@mrdima
mrdima / fix-weave-snat.sh
Last active September 24, 2020 09:39
Retain source IP for weave overlay network in Kubernetes
#!/bin/bash
# Inserts or removes iptables rules to prevent snat to the hosts local weave ip ranges
# This way the source ip will be retained for traffic not coming from weave
# Requires weave to be running, the script does wait for weave report to respond
echo running $0 $1
action="${1:-start}"
echo action: ${action}
#functions taken from: https://stackoverflow.com/questions/10768160/ip-address-converter
dec2ip () {
local ip dec=$@
# git clone from https://github.com/tkarras/progressive_growing_of_gans
# download the snapshot from their Google drive
# use the following code in the same directory to generate random faces
import os
import sys
import time
import glob
import shutil
import operator
import theano
@apeckham
apeckham / format.json
Last active April 1, 2022 16:45
fastly json log format
{
"service_id":"%{req.service_id}V",
"service_version":"%{fastly_info.version}V",
"time_start":%{begin:msec}t,
"time_end":%{end:msec}t,
"time_elapsed":%{time.elapsed.usec}V,
"client_ip":"%{req.http.Fastly-Client-IP}V",
"request":"%{req.request}V",
"protocol":"%{req.proto}V",
"host":"%{req.http.Fastly-Orig-Host}V",
@mgoodness
mgoodness / k8s-svc-annotations.md
Last active July 11, 2024 06:17
AWS ELB-related annotations for Kubernetes Services (as of v1.12.0)
  • 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-additional-resource-tags (comma-separated list of key=value)
  • 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)
@thomasfr
thomasfr / warmly.sh
Last active October 12, 2023 06:17
A wget based easy poor man`s cache warmer script
#!/bin/bash
# warmly.sh
# A wget based, easy, poor man`s cache warmer script
# https://gist.github.com/thomasfr/7926314
# The MIT License (MIT)
#
# Copyright (c) 2013,2014 Thomas Fritz <fritztho@gmail.com> (http://fritzthomas.com)
#
@chales
chales / cache-warmer-3.sh
Last active January 19, 2022 14:01
A couple of simple options to parse sitemap.xml to warm the cache or for other actions such as generating memory_profiler checks.
# This can be added to your cron job to run right after Drupal's cron or combine them into a single command so
# that it automatically executes when the cron run completes.
wget -q http://www.example.com/sitemap.xml -O - | egrep -o "http://www\.example\.com[^<]+" | wget -q -i - -O /dev/null --wait 1
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active July 16, 2024 15:14
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), 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(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'