Skip to content

Instantly share code, notes, and snippets.

# setting a new alias
git config --global --add alias.lol "log --graph --decorate --pretty=oneline --abbrev-commit --all"
# using the new alias
git lol
@maxclaus
maxclaus / docker-elk.sh
Created March 29, 2015 18:49
Docker ELK - Logs agregator for Docker containers
/usr/bin/docker run \
--restart=always \
-d \
--name logs-elasticsearch_1 \
-v /data/logs_elasticsearch/config:/usr/share/elasticsearch/config -v /data/logs_elasticsearch/data:/usr/share/elasticsearch/data \
-p 172.17.42.1:9200:9200 -p 172.17.42.1:9300:9300 \
elasticsearch:1.5.0
/usr/bin/docker run \
@maxclaus
maxclaus / update-coreos-cloud-config.sh
Created February 28, 2015 03:08
Update coreos cloud config
#!/bin/bash
SERVER_IP=<MY_SERVER_IP>
# copy cloud-config.yml to the server
scp cloud-config.yml core@$SERVER_IP:~/
# validate cloud-config file
ssh core@$SERVER_IP "coreos-cloudinit -validate --from-file ~/cloud-config.yml"
if [[ $? == "0" ]]; then
from flask import Flask, render_template, redirect, url_for
from flask.ext.sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config.from_object('config')
db = SQLAlchemy(app)
# Basic Routes #
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$FG[245]%}git:("
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$FG[245]%})%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}●%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN=""
ZSH_THEME_SVN_PROMPT_PREFIX=$ZSH_THEME_GIT_PROMPT_PREFIX
ZSH_THEME_SVN_PROMPT_SUFFIX=$ZSH_THEME_GIT_PROMPT_SUFFIX
ZSH_THEME_SVN_PROMPT_DIRTY=$ZSH_THEME_GIT_PROMPT_DIRTY
ZSH_THEME_SVN_PROMPT_CLEAN=$ZSH_THEME_GIT_PROMPT_CLEAN
vcs_status() {
var libxmljs = require("libxmljs");
var xml = [
'<?xml version="1.0" encoding="utf-8"?>',
'<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">',
' <soap:Body>',
' <Response xmlns="http://tempuri.org/">',
' <Result>',
' <client xmlns="">',
' <msg>SEARCH OK.</msg>',
' <code>0</code>',
#!/usr/bin/env python
"""
Check all existing Docker containers for their mapped paths, and then purge any
zombie directories in docker's volumes directory which don't correspond to an
existing container.
"""
import logging
import os
import sys
@maxclaus
maxclaus / example1.js
Created October 8, 2014 19:40
Javascript Double Not-Operator(!!)
if (typeof x !=== 'undefined' && x !=== '') {
// not emtpy
}
curl -H "Content-Type: application/json" -d '{ "field": "value" }' http://someurl.com
@maxclaus
maxclaus / regex
Created July 11, 2014 14:03
regex to match strings that do not start with a specific string
^(?!One|Two|Four)+.*