Skip to content

Instantly share code, notes, and snippets.

View xarses's full-sized avatar

Andrew Woodward xarses

  • San Francisco, Bay Area, CA
View GitHub Profile
from Crypto.Cipher import DES
from hashlib import md5
class PBEWithMD5AndDES(object):
"""PBES1 implementation according to RFC 2898 section 6.1"""
SALT = '\x0c\x9d\x4a\xe4\x1e\x83\x15\xfc'
COUNT = 5
def __init__(self, key):
key = self._generate_key(key, self.SALT, self.COUNT, 16)
@xarses
xarses / example deployment
Last active December 21, 2015 23:48
serial cehp-deploy
mon1:# ceph-deploy new mon1
mon1:# echo "public_network: 10.0.0.0/24" >> ceph.conf
mon1:# ceph-deploy create mon1
mon1:# ceph-deploy osd create mon1:sdb
...later...
mon2:# ceph-deploy config pull mon1
mon2:# ceph-deploy gatherkeys mon1
mon2:# ceph-deploy create mon2
@xarses
xarses / gist:6599234
Created September 17, 2013 19:10
example ceph-deploy using network decl
given host mon-1
hostname -s
> mon-1
eth0: 10.0.0.2/24
eth1: 10.0.1.2/24
eth2: 192.168.1.2/24
host mon-1
> 192.168.1.2
@xarses
xarses / fuel 2.2
Last active December 24, 2015 03:09
Openstack-Fuel site.pp snippet for bonding
#Network configuration
stage {'netconfig':
before => Stage['main'],
}
class {'l23network': stage=> 'netconfig'}
class node_netconfig (
$mgmt_ipaddr,
$mgmt_netmask = '255.255.255.0',
$private_ipaddr = undef,
@xarses
xarses / gist:6815516
Created October 3, 2013 19:19
ceph-deploy osd create / prepare logic
1) if ceph-deploy osd create/prepare is passed a whole device (ie sda) then it will format the device and create two partitions, one for the journal, and one of the osd its self
2) if ceph-deploy osd create/prepare is passed a partitioned device (ie sda1) it formats the partition and creates a journal FILE inside the partition
3) if ceph-deploy osd create/prepare is passed a mounted path, ie (/mnt/osd) it will do create a journal FILE in side the mount path
4) in the case of ceph-deploy being passed a device/sub-device/path and a journal file-path (ie sda:/mounts/journal/journal-sda) it will do whichever is relevant (a whole device will get a partition and mkfs) (a subdevice will get a mkfs) and a journal FILE will be created at the journal file-path. from my experience, if the journal file-path is invalid it will default to its default location for the journal.
examples:
@xarses
xarses / .git_config
Last active December 26, 2015 09:09
Git post hook setup script.
[remote "node"]
fetch = +refs/heads/*:refs/remotes/node/*
url = ssh://10.108.3.2/root/git-repo/fuel.git
url = ssh://10.108.7.2/root/git-repo/fuel.git
url = ssh://10.108.11.2/root/git-repo/fuel.git
@xarses
xarses / 3d7508e06572_master_from_14f3652.py
Created April 11, 2014 20:19
./manage.py migrate revision -m "master from 14f3652" --autogenerate
"""master from 14f3652
Revision ID: 3d7508e06572
Revises: 4f21f21e2672
Create Date: 2014-04-11 13:15:56.563349
"""
# revision identifiers, used by Alembic.
revision = '3d7508e06572'
#!/bin/bash
if [[ $(head /sys/kernel/mm/ksm/run) = "0" ]] ; then
echo "ksm is not enabled. /sys/kernel/mm/ksm/run must be 1"
return 1
fi
files=$(ls /sys/kernel/mm/ksm/pages*)
pagesz=$(getconf PAGESIZE)
for file in $files
@xarses
xarses / directions.md
Last active August 29, 2015 14:09
testing fuel-library changes
  1. copy pull-changes.sh from raw

    note: link could be wrong if updated below

    wget https://gist.githubusercontent.com/xarses/7cd6a335055546078a31/raw/pull-change.sh
  2. find review you want to test and go to patch set download section. Select pull, you should see line like

@xarses
xarses / auth-curl.sh
Last active August 29, 2015 14:10
using curl again with auth'd fuel
#!/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" $@