Skip to content

Instantly share code, notes, and snippets.

View mmalchuk's full-sized avatar

Maksim Malchuk mmalchuk

View GitHub Profile
@mmalchuk
mmalchuk / web-servers.md
Created August 30, 2017 12:50 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@mmalchuk
mmalchuk / masq.sh
Created May 23, 2017 18:50 — forked from mowings/masq.sh
script to get xet xhyve working with all vpn interfaces
#!/bin/bash
interfaces=( $(netstat -in | egrep 'utun\d .*\d+\.\d+\.\d+\.\d+' | cut -d ' ' -f 1) )
rulefile="rules.tmp"
echo "" > $rulefile
sudo pfctl -a com.apple/tun -F nat
for i in "${interfaces[@]}"
do
RULE="nat on ${i} proto {tcp, udp, icmp} from 192.168.64.0/24 to any -> ${i}"
echo $RULE >> $rulefile
done
@mmalchuk
mmalchuk / libvirt_generate_UUID_MAC.py
Created December 9, 2016 07:50 — forked from orimanabu/libvirt_generate_UUID_MAC.py
generate MAC address and UUID for libvirt KVM guest.
#!/usr/bin/env python
import virtinst.util
print "UUID:\t", virtinst.util.uuidToString(virtinst.util.randomUUID())
print "MAC:\t", virtinst.util.randomMAC(type="qemu")
# for one-liner
# python -c 'from virtinst.util import *; print uuidToString(randomUUID())'
# python -c 'from virtinst.util import *; print randomMAC(type="qemu")'
@mmalchuk
mmalchuk / fuel_tasks.rb
Created April 11, 2016 06:14 — forked from michalskalski/fuel_tasks.rb
Print granual task for specific role
#!/usr/bin/env ruby
require 'yaml'
# fuel rel --rel X --deployment-tasks --download
tasks_file = ARGV[0]
role = ARGV[1]
tasks = YAML.load_file(tasks_file)
def info(task)
#!/usr/bin/env python
import itertools
import socket
import time
from launchpadlib import uris
from launchpadlib.launchpad import Launchpad
@mmalchuk
mmalchuk / gist:7b63ea9a371bac76e7921afb79fa5230
Created April 11, 2016 06:09 — forked from dims/gist:2ba347b79da3ccdc882a
Scan the Nova "In Progress" Launchpad bugs for abandoned reviews
#!/usr/bin/env python
from launchpadlib import uris
from launchpadlib.launchpad import Launchpad
def get_abandoned_bugs(projects=None):
if projects is None:
projects = [
'nova'
@mmalchuk
mmalchuk / parked_bugs.py
Created April 11, 2016 06:08 — forked from dims/parked_bugs.py
Bugs marked "In Progress" but no reviews
#!/usr/bin/env python
import itertools
from launchpadlib import uris
from launchpadlib.launchpad import Launchpad
if __name__ == "__main__":
projects = [
'nova',
@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");
@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
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