Skip to content

Instantly share code, notes, and snippets.

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>',
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() {
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 #
@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
@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 \
# setting a new alias
git config --global --add alias.lol "log --graph --decorate --pretty=oneline --abbrev-commit --all"
# using the new alias
git lol
for file in *.html; do; mv "$file" "${file%.html}.txt"; done
# remove dangling images
docker rmi $(docker images -q -f dangling=true)
# remove dead containers
docker rm $(docker ps -aq)
@maxclaus
maxclaus / ssh-tunnel.sh
Created June 17, 2015 19:52
ssh tunnel and multiple tunnels
# single tunnel
ssh -L <local-ip-on-my-machine>:<local-port-on-my-machine>:\
<local-ip-on-server>:<local-port-on-server> \
-C -N <server-user>@<server-ip>
# EXMAPLES
# -------------
# SINGLE TUNNEL
ssh -L 0.0.0.0:27017:172.17.42.1:27017 -C -N [email protected]
# -------------
@maxclaus
maxclaus / docker-cleanup-volumes.sh
Created July 15, 2015 01:44
Script to remove orphaned docker volumes
#!/bin/bash
# Usage:
# - To only show the possbible volumes to be removed:
# ./docker-cleanup-volumes.sh
# - To remove orphaned docker volumes:
# ./docker-cleanup-volumes.sh clean
if [ "$1" == 'clean' ]; then
echo "cleaning..."