Skip to content

Instantly share code, notes, and snippets.

@netman2k
netman2k / nfs-tuning.md
Created March 22, 2021 02:14 — forked from denji/nfs-tuning.md
NFS Attribute Caching Performance Impact on Web Applications

A couple of days ago, I had some issues with NFS consistency, not every servers were up to date. Some servers had the good version of the file some hadn’t. However performing a ls -l seemed to fixed tempory the problem after each update (where a simple ls didn’t). Indeed issuing ls with the -l option triggers stat() where ls doesn’t, just because file attributes are called from the stats() function. I needed to investigate…

I. Story

We determined that some web virtual didn’t delivered the same content, some page weren’t updated properly. We quickly figured out that the issue was located of the NFS attribute caching, by default too long, at least in our setup. The first change we made was to enable the noac option on the client mount. However while trying to enhance the consistency of the NFS data, the performance impact was pretty high. The impact was easy to detect and reproduce. Basically everytime a page was request from the webser, the client had to request the NFS server to be sure to del

@netman2k
netman2k / ec2_info_retriever.py
Created August 24, 2020 02:51 — forked from dastergon/ec2_info_retriever.py
A basic boto3 based tool for retrieving information from running EC2 instances.
from collections import defaultdict
import boto3
"""
A tool for retrieving basic information from the running EC2 instances.
"""
# Connect to EC2
ec2 = boto3.resource('ec2')
@netman2k
netman2k / gist:de36327c7da26d4166b513c4b2119366
Created December 27, 2019 06:27
VSCode - C project configuration snippet
.vscode/c_cpp_properties.json
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
@netman2k
netman2k / SSL-certs-OSX.md
Created May 31, 2019 12:36 — forked from croxton/SSL-certs-OSX.md
Generate ssl certificates with Subject Alt Names

Generate ssl certificates with Subject Alt Names on OSX

Open ssl.conf in a text editor.

Edit the domain(s) listed under the [alt_names] section so that they match the local domain name you want to use for your project, e.g.

DNS.1   = my-project.dev

Additional FQDNs can be added if required:

@netman2k
netman2k / launch_docker_openvpn.sh
Created October 16, 2017 06:02
OpenVPN Docker Launch script
#!/bin/bash
# Reference
# https://github.com/kylemanna/docker-openvpn
#
set -o errexit
OVPN_DATA=/usr/local/etc/openvpn
# Init OpenVPN server configurations
# Please refer the URL below to see specific options
# https://github.com/kylemanna/docker-openvpn/blob/master/bin/ovpn_genconfig
@netman2k
netman2k / vagrant.py
Last active October 12, 2017 11:04 — forked from lorin/vagrant.py
Vagrant dynamic inventory script for Ansible
#!/usr/bin/env python
# Adapted from Mark Mandel's implementation
# https://github.com/ansible/ansible/blob/devel/plugins/inventory/vagrant.py
import argparse
import json
import paramiko
import subprocess
import sys
@netman2k
netman2k / _INSTALL.md
Created June 1, 2017 11:51 — forked from robinsmidsrod/_INSTALL.md
Bootstrapping full iPXE native menu with customizable default option with timeout (also includes working Ubuntu 12.04 preseed install)

Add the following chunk to your existing ISC dhcpd.conf file.

if exists user-class and ( option user-class = "iPXE" ) {
    filename "http://boot.smidsrod.lan/boot.ipxe";
}
else {
    filename "undionly.kpxe";
}

(or see https://gist.github.com/4008017 for a more elaborate setup

@netman2k
netman2k / rpm-digital-signature.sh
Created May 16, 2017 06:53 — forked from fernandoaleman/rpm-digital-signature.sh
How to sign your custom RPM package with GPG key
# How to sign your custom RPM package with GPG key
# Step: 1
# Generate gpg key pair (public key and private key)
#
# You will be prompted with a series of questions about encryption.
# Simply select the default values presented. You will also be asked
# to create a Real Name, Email Address and Comment (comment optional).
#
# If you get the following response:
@netman2k
netman2k / solr.service
Created March 16, 2017 05:01 — forked from hammady/solr.service
systemd service file for Apache SOLR
# put this file in /etc/systemd/system/ as root
# below paths assume solr installed in /opt/solr, SOLR_PID_DIR is /data
# and that all configuration exists in /etc/default/solr.in.sh which is the case if previously installed as an init.d service
# change port in pid file if differs
# note that it is configured to auto restart solr if it fails (Restart=on-faliure) and that's the motivation indeed :)
# to switch from systemv (init.d) to systemd, do the following after creating this file:
# sudo systemctl daemon-reload
# sudo service solr stop # if already running
# sudo systemctl enable solr
# systemctl start solr
@netman2k
netman2k / glustertop.py
Created February 21, 2017 02:04 — forked from fpytloun/glustertop.py
Real time GlusterFS top-like monitoring
#!/usr/bin/env python
"""
Display gluster traffic
This tool uses gluster profiling feature, parsing cumulative statistics.
To understand correctly the results, you have to divide overall write statistics with number of replicas.
Also striped volumes needs to be taken in mind - overall statistics just print sum of all bricks
read/written bytes.