Skip to content

Instantly share code, notes, and snippets.

View bcambel's full-sized avatar
🌴
On vacation

Bahadir Cambel bcambel

🌴
On vacation
View GitHub Profile
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.
  1. General Background and Overview
@bcambel
bcambel / chunk.py
Created January 7, 2014 20:48
A chunker example
def chunks(l, n):
""" Yield successive n-sized chunks from l."""
for i in xrange(0, len(l), n):
yield l[i:i+n]
list(chunks([1, 2, 3, 4, 5, 6, 7, 8, 9], 3))
#[[1, 2, 3], [4, 5, 6], [7, 8, 9]]
#[[1, 2], [3, 4], [5, 6]]
<!-- Raven.js Config -->
<script src="{{ JS_PATH }}/lib/raven.js" type="text/javascript"></script>
<script type="text/javascript">
// Ignore list based off: https://gist.github.com/1878283
var ravenOptions = {
// Will cause a deprecation warning, but the demise of `ignoreErrors` is still under discussion.
// See: https://github.com/getsentry/raven-js/issues/73
ignoreErrors: [
// Random plugins/extensions
'top.GLOBALS',
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Testing Pie Chart</title>
<!--<script type="text/javascript" src="d3/d3.v2.js"></script>-->
<script src="http://d3js.org/d3.v2.js"></script>
<!-- Note: I made good use of the sample code provided by the D3JS community and extended it to fit my needs to create this simple dashboard -->
<style type="text/css">
@bcambel
bcambel / README.md
Created January 21, 2014 02:26 — forked from mbostock/.block

So fun, right? But think twice before you use gratuitous enter animations; they can be annoying! The motion is distracting if you’re reading text elsewhere on the page. And, if you’re looking at the visualization, the animation forces you to wait. Instead, use animation to facilitate by making it easier to follow data across views, or as a form of visual explanation. For more details, read Object Constancy.

@bcambel
bcambel / deploy.py
Created January 24, 2014 18:34
Fabric Deployment
import datetime
from fabric.api import cd, env, local, run, settings, task
from fabric.decorators import runs_once
from os.path import abspath, dirname
@task
@runs_once
def tag_release():
utc_str = datetime.datetime.utcnow().strftime("%Y-%m-%d-%H-%M-%S")
$template TestFormat,"Message: %msg%\n"
$template TestFile,"/tmp/test_%$year%%$month%%$day%%$hour%.log"
# Writes matching messages to path defined by TestFile template in TestFormat format
:syslogtag, contains, "test" -?TestFile;TestFormat
# Drops messages matching this syslog tag
:syslogtag, contains, "test" ~
@bcambel
bcambel / nginx.conf
Created February 2, 2014 15:24
Battle tested Nginx config from http://blog.zachorr.com/nginx-setup/
user www-data;
pid /var/run/nginx.pid;
worker_processes auto;
worker_rlimit_nofile 65000;
events {
worker_connections 2048;
multi_accept on;
use epoll;
}
@bcambel
bcambel / goodies.bash
Created February 11, 2014 13:26
Unix goodies
# get the largest 10 under current directory
du -hsx * | sort -rh | head -10