Skip to content

Instantly share code, notes, and snippets.

View akatrevorjay's full-sized avatar
🌙

Trevor Joynson akatrevorjay

🌙
View GitHub Profile
@bdarnell
bdarnell / streaming.py
Created January 11, 2015 21:23
Demo of streaming requests with Tornado
"""Demo of streaming requests with Tornado.
This script features a client using AsyncHTTPClient's body_producer
feature to slowly produce a large request body, and two server
handlers to receive this body (one is a proxy that forwards to the
other, also using body_producer).
It also demonstrates flow control: if --client_delay is smaller than
--server_delay, the client will eventually be suspended to allow the
server to catch up. You can see this in the logs, as the "client
@renoirb
renoirb / files-ssl.cnf
Last active January 11, 2020 22:54
Creating on a server MySQL configuration. Using those three
[client]
ssl
ssl-ca=/etc/mysql/ca-cert.pem
ssl-cert=/etc/mysql/client-cert.pem
ssl-key=/etc/mysql/client-key.pem
[mysqld]
ssl
ssl-cipher=DHE-RSA-AES256-SHA
ssl-ca=/etc/mysql/ca-cert.pem
@eliasp
eliasp / salt#master.sls
Last active December 27, 2015 20:29
Saltmaster Dockerfiles
python-pip:
pkg.installed
docker-py:
pip.installed:
- require:
- pkg: python-pip
# TODO: ensure docker-py is declared a requirement for all dockerio states without having to explicitely declare the requirement in each container state again
@holmboe
holmboe / formulas.py
Last active January 8, 2022 17:08
A meta-repository that collects all Salt formula repositories at https://github.com/saltstack-formulas
#!/usr/bin/env python
'''
Tool to manage a local copy of formulas (https://github.com/saltstack-formulas).
'''
import base64
import contextlib
import logging
import os
import re
@brolewis
brolewis / schedulers.py
Last active March 6, 2022 22:53
A distributed job scheduler for Celery using ZooKeeper (via kazoo) to manage the locking.
'''Zookeeper-based Scheduler'''
## Standard Library
import cPickle # Store dictionary in ZooKeeper
import datetime # Time delta
import socket # Hostname
## Third Party
import celery # Current app
import celery.beat # Scheduler
import celery.utils.log # Get logger
import kazoo.client # ZooKeeper Client Library
@ck-on
ck-on / ocp.php
Last active March 25, 2024 09:30
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)#ocp #php #opcache #opcode #cache #zend #optimizerplus #optimizer+
<?php
/*
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)
Author: _ck_ (with contributions by GK, stasilok)
Version: 0.1.7
Free for any kind of use or modification, I am not responsible for anything, please share your improvements
* revision history
0.1.7 2015-09-01 regex fix for PHP7 phpinfo
0.1.6 2013-04-12 moved meta to footer so graphs can be higher and reduce clutter
@sogoo
sogoo / gist:4644583
Last active December 1, 2017 06:11
MultiColumn Bookmarks 4 Firefox
/* MultiColumn Bookmarks for Firefox */
#bookmarksMenu menupopup .scrollbox-innerbox, .bookmark-item[container="true"] menupopup .scrollbox-innerbox {
width: 650px !important; /*display width*/
/* width: 850px !important; *//*4 colonnes*/
display: table !important;
}
#bookmarksMenu .bookmark-item, .bookmark-item[container="true"] .bookmark-item {
min-width: 300px !important;/*title width*/
@UtahDave
UtahDave / module.sls
Created June 11, 2012 20:30 — forked from anonymous/module.sls
Apache module macro for salt
{% macro a2mod(module, enabled=true) -%}
{% if enabled %}
a2enmod {{ module }}:
cmd:
- run
- unless: test -L /etc/apache2/mods-enabled/{{ module }}.load
- require:
- pkg: apache2
- watch_in:
- service: apache2
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

{% macro postconf(key, value) -%}
postconf-{{ key }}:
cmd:
- run
- name:
- postconf -e {{ key }}='{{ value }}'
- unless: test "x$(postconf -h {{ key }} )" = 'x{{ value }}'
- require:
- pkg: postfix