Skip to content

Instantly share code, notes, and snippets.

@statik
statik / gist:981961
Created May 19, 2011 22:34 — forked from jtimberman/gist:548261
preseed.cfg for automated installations with chef from apt.opscode.com
# This is the entire preseed config file used on an example Lucid system. See the preseed
# documentation for more information on the options here. This will use US English by default.
#
# https://help.ubuntu.com/10.04/installation-guide/amd64/preseed-contents.html
#
# This preseed will automatically install Ubuntu 10.04 with default options. Understand what
# it is doing before you use it.
#
# Boot Options line:
#
@click0
click0 / random-ipv6-address-generator.15.sh
Created June 8, 2011 11:36
random generator ipv6 address
#!/bin/sh
# Copyright Andrey Mitrofanov
# Copyright pavlinux http://pavlinux.ru
# 2011
MAXCOUNT=20
count=0
network_v6=2a01:7a0:2:12 # your ipv6 network prefix
@SteveClement
SteveClement / get_dir_size.py
Created September 20, 2012 12:18
Get Directory size in python
import os
def get_size(start_path = '.'):
total_size = 0
for dirpath, dirnames, filenames in os.walk(start_path):
for f in filenames:
fp = os.path.join(dirpath, f)
total_size += os.path.getsize(fp)
return total_size
print get_size()
# coding=utf-8
"""
LICENSE http://www.apache.org/licenses/LICENSE-2.0
"""
import datetime
import sys
import time
import threading
import traceback
import SocketServer
@denji
denji / nginx-tuning.md
Last active July 8, 2025 00:03
NGINX tuning for best performance

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@DavidWittman
DavidWittman / supermicro-ipmi-mac-address.md
Last active June 16, 2025 12:53
Pull the LAN1/eth0 MAC address from SuperMicro IPMI

You can find the MAC address for LAN1/eth0 (not the BMC MAC) via the SuperMicro IPMI interface by running the following command:

$ ipmitool -U $IPMI_USER -P $IPMI_PASS -H $IPMI_HOST raw 0x30 0x21 | tail -c 18

The eth0 MAC address will be output in this format:

00 25 90 f0 be ef
@StephanieSunshine
StephanieSunshine / interfaces
Created October 8, 2014 10:13
Linode Debian / Ubuntu GRE tunnels hack /etc/network/interfaces
# One side, change the address by a digit and reverse the outside ip addresses for the other side
auto gre1
iface gre1 inet static
address 10.10.10.10 # inside side a address
netmask 255.255.255.0
pre-up ip tunnel add gre1 mode gre remote 173.230.145.76 local 173.230.147.224 #remote external ip local external ip
post-down ip tunnel del gre1
@jkjuopperi
jkjuopperi / proxycache.py
Created October 16, 2014 16:19
nginx proxy cache listing and purging tool in python
#!/usr/bin/env python
from __future__ import print_function
import os
import sys
from collections import namedtuple
CacheFile = namedtuple('CacheFile', ['path', 'key'])
def read_cache_file(path):
with open(path, 'r') as f:
f.seek(0x28) # skip header
key_magic = f.read(6)
@cnDelbert
cnDelbert / How to install tcpping on Linux.md
Last active December 23, 2024 21:15
How to install tcpping on Linux

To install tcptraceroute on Debian/Ubuntu:

$ sudo apt-get install tcptraceroute

To install tcptraceroute on CentOS/REHL, first set up RepoForge on your system, and then:

$ sudo yum install tcptraceroute
@josephholsten
josephholsten / json-log.conf
Created January 22, 2015 01:12
Complete JSON nginx log_format
# json-log.conf - log all useful nginx variables in json formatted log
# for details about these variables, see http://nginx.org/en/docs/http/ngx_http_core_module.html#variables
log_format json-log '{'
# $arg_*
# $args
# $binary_remote_addr
'"body_bytes_sent":"$body_bytes_sent",'
'"bytes_sent":"$bytes_sent",'
'"connection":"$connection",'
# $connection_requests