Skip to content

Instantly share code, notes, and snippets.

View mmalchuk's full-sized avatar

Maksim Malchuk mmalchuk

View GitHub Profile
@mmalchuk
mmalchuk / recipe.rb
Created December 16, 2013 14:51 — forked from yurinnick/recipe.rb
# Source accepts the protocol s3:// with the host as the bucket
# access_key_id and secret_access_key are just that
s3_file "/var/bulk/the_file.tar.gz" do
source "s3://your.bucket/the_file.tar.gz"
access_key_id your_key
secret_access_key your_secret
owner "root"
group "root"
mode 0644
end
from fabric.api import local, run
from pyquery import PyQuery as pq
BASE_URL = "http://hackermonthly.com/"
HACKER_URL = "http://hackermonthly.com/issues.html"
d = pq(url=HACKER_URL)
issue_list = d("#issues li a")
def get_issue(inex, node):
d = pq(node)
@mmalchuk
mmalchuk / auth-curl.sh
Last active August 29, 2015 14:21 — forked from xarses/auth-curl.sh
#!/bin/bash
if [ -z $OS_TOKEN ] ; then
export OS_TOKEN=$(python -c 'from fuelclient.client import Client
print Client().auth_token')
echo got my own OS_TOKEN=${OS_TOKEN}
fi
curl -H "X-Auth-Token: $OS_TOKEN" $@
@mmalchuk
mmalchuk / directions
Last active August 29, 2015 14:21 — forked from xarses/directions
dockerctl shell nailgun
manage.py drobdb
manage.py syncdb
manage.py loaddefault
exit
@mmalchuk
mmalchuk / launch_my.sh
Created September 23, 2015 14:13
my fuel vbox script with macos bridges for E///
#!/bin/sh
# ask for a password only once
sudo true
export CONFIG_FOR="16GB"
source ./config.sh
source ./functions/vm.sh
source ./functions/network.sh
wget http://winhelp2002.mvps.org/hosts.txt -qO - |\
sudo bash -c "sed 's/^\(.*\).$/\1/' >>/etc/hosts"
require 'psych'
module SafeYAML
def self.dump obj, io = nil, options = {}
visitor = Psych::Visitors::YAMLTree.new(options)
visitor << obj
ast = visitor.tree
ast.grep(Psych::Nodes::Scalar).each do |node|
def safe_yaml_dump(obj)
visitor = Psych::Visitors::YAMLTree.new({})
visitor << obj
visitor.tree.grep(Psych::Nodes::Scalar).each do |node|
node.style = Psych::Nodes::Scalar::DOUBLE_QUOTED if
node.value =~ /^0[xbod]+/i && node.plain && node.quoted
end
visitor.tree.yaml(nil, {})
end
@mmalchuk
mmalchuk / add_base_repo.sh
Created December 26, 2015 13:39
add an external base repo in Fuel
grep -q "[base]" /etc/yum.repos.d/extra.repo 2>/dev/null || cat <<EOF >>/etc/yum.repos.d/extra.repo
#####
[base]
name=CentOS-\$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=\$releasever&arch=\$basearch&repo=os
gpgcheck=0
#####
EOF
@mmalchuk
mmalchuk / exists.rb
Created December 26, 2015 21:40 — forked from j4m3s/exists.rb
Puppet "exists" function ...
#
# exists.rb
#
# James Fellows 8/8/12: cloned from git://gist.github.com/1160472.git then
# modified to resolve puppet:/// paths
#
# Copyright 2011 Puppet Labs Inc.
# Copyright 2011 Krzysztof Wilczynski
#
# Licensed under the Apache License, Version 2.0 (the "License");