Skip to content

Instantly share code, notes, and snippets.

@iimos
iimos / optimize-images.sh
Last active August 21, 2023 08:50
Script for JPEG images optimization
#! /bin/sh
# Usage 1:
# optimize-images.sh /images/dir
#
# Usage 2:
# cd /images/dir
# optimize-images.sh
EXTENSIONS="jpe?g"
@plentz
plentz / nginx.conf
Last active May 17, 2024 09:08
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@tegansnyder
tegansnyder / example-varnish.vcl
Created September 18, 2013 15:52
Example VCL for Magento and Varnish using Turpentine
C{
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <pthread.h>
static pthread_mutex_t lrand_mutex = PTHREAD_MUTEX_INITIALIZER;
void generate_uuid(char* buf) {
pthread_mutex_lock(&lrand_mutex);
long a = lrand48();
long b = lrand48();
#!/bin/bash
PROGNAME=${0##*/}
INPUT=''
QUIET='0'
NOSTATS='0'
max_input_size=0
max_output_size=0
usage()
@miped
miped / magento
Created March 8, 2013 12:28
nginx + php-fpm magento setup
# /etc/nginx/sites-enabled/magento
server {
listen 80;
server_name ec2-184-72-68-219.compute-1.amazonaws.com;
root /var/www/magento/;
access_log /var/log/nginx/magento-access_log;
error_log /var/log/nginx/magento-error_log;
location / {
@follmann
follmann / Manual and upstart config for AeroFS (aerofs-cli) on Ubuntu 12.04.1 LTS
Last active May 19, 2022 05:35
Manual and upstart config for AeroFS (aerofs-cli) on Ubuntu 12.04.1 LTS
Manual and upstart config for AeroFS (aerofs-cli) on Ubuntu 12.04.1 LTS:
# link standard upstart script
cd /etc/init.d
sudo ln -s /lib/init/upstart-job aerofs-cli
# create upstart config for aerofs-cli
sudo nano /etc/init/aerofs-cli.conf
(replace andreas with your desired runtime user)
----
@kfox
kfox / sysctl.conf
Created February 29, 2012 17:32
Linux kernel tuning settings for large number of concurrent clients
# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
# sysctl.conf(5) for more details.
# Controls source route verification
net.ipv4.conf.default.rp_filter = 1
# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0
@fennb
fennb / gist:1283573
Created October 13, 2011 06:35
nginx microcaching config example
# Set cache dir
proxy_cache_path /var/cache/nginx levels=1:2
keys_zone=microcache:5m max_size=1000m;
# Virtualhost/server configuration
server {
listen 80;
server_name yourhost.domain.com;
# Define cached location (may not be whole site)