Skip to content

Instantly share code, notes, and snippets.

# Model
from concurrency.fields import IntegerVersionField
class Image(models.Model):
id = models.CharField(max_length=36, primary_key=True)
human_id = models.CharField(max_length=255, null=True) # some images don't have human_id
name = models.CharField(max_length=255)
tenant_id = models.CharField(max_length=255, null=True) # some images don't have tenant_id
version = IntegerVersionField() # django-concurrency
@sudokai
sudokai / sysctl.conf
Last active August 29, 2015 14:15 — forked from kgriffs/sysctl.conf
# Configuration file for runtime kernel parameters.
# See sysctl.conf(5) for more information.
# See also http://www.nateware.com/linux-network-tuning-for-2013.html for
# an explanation about some of these parameters, and instructions for
# a few other tweaks outside this file.
# Protection from SYN flood attack.
net.ipv4.tcp_syncookies = 1

Linux simple performance tweaks

Change the I/O Scheduler

Open $ vim /etc/default/grub then add elevator=noop next to GRUB_CMDLINE_LINUX_DEFAULT. Run $ update-grub and $ cat /sys/block/sda/queue/scheduler to be sure that noop is being used:

$ vim /etc/default/grub
$ update-grub
$ cat /sys/block/sda/queue/scheduler

[noop] deadline cfq

@sudokai
sudokai / cloud-config
Last active August 29, 2015 14:14 — forked from tsertkov/cloud-config
#cloud-config
coreos:
units:
- name: systemd-sysctl.service
command: restart
- name: create-swap.service
command: start
runtime: true
content: |
@sudokai
sudokai / CoreOS swap
Last active August 29, 2015 14:14 — forked from kacinskas/CoreOS swap
# swith to sudo
sudo -i
# create swap
touch /2GiB.swap
chattr +C /2GiB.swap
fallocate -l 2048m /2GiB.swap
chmod 600 /2GiB.swap
mkswap /2GiB.swap