knife bootstrap json-attributes example

By polfilm,

This is how you properly pass Json string in knife bootstrap

$ knife bootstrap --run-list "role[myiisapp]" --json-attributes "{\"remote_mysql\": {\"ip\": \"10.10.10.100\"}}" --ssh-user root --ssh-password password hostname

berks upload – Encoding::InvalidByteSequenceError: “\xE2” on US-ASCII

By polfilm,

This happens during cookbook upload to chef server and is due to unicode characters in README.md (at least in my case)

Ridley::CookbookResource crashed!
Encoding::InvalidByteSequenceError: "\xE2" on US-ASCII

I’ve used the following command to list offending characters in README.md. Then removed with gedit, resaved and…. upload success!

grep --color='auto' -P -n "[\x80-\xFF]" README.md

Full stack here: http://fpaste.org/51397/

Reported, here: https://github.com/RiotGames/berkshelf/issues/708

How to checkout Nova Folsom or Grizzly branch on github

By polfilm,

Clone branch directly

git clone --branch stable/grizzly https://github.com/openstack-dev/devstack.git

Create local repo branch with copy…

git checkout -b folsom  remotes/origin/stable/folsom
Checking out files: 100% (2510/2510), done.
Branch folsom set up to track remote branch stable/folsom from origin.
Switched to a new branch 'folsom'
 
git branch -a
* folsom
  master
  remotes/origin/HEAD -> origin/master
  remotes/origin/master
  remotes/origin/stable/folsom
  remotes/origin/stable/grizzly
 
 git branch -a -v
* folsom                        6740c41 Check QCOW2 image size during root disk creation
  master                        e4f05ba Imported Translations from Transifex
  remotes/origin/HEAD           -> origin/master
  remotes/origin/master         e4f05ba Imported Translations from Transifex
  remotes/origin/stable/folsom  6740c41 Check QCOW2 image size during root disk creation
  remotes/origin/stable/grizzly 159fdd2 Merge "Detach volume fails when using multipath iscsi" into stable/grizzly

http://rtomaszewski.blogspot.co.uk/2013/05/how-to-checkout-nova-folsom-or-grizzly.html

Over 1000 D3.js Examples and Demos

By polfilm,

One of the best things that I like about D3 is the ridiculous amount of awesome demos available online and last night I have stumbled on an excel sheet with 1,134 examples of data visualizations with D3. If you are just starting out with D3 you will appreciate the well organized API docs and really great tutorials and cheat sheets but there is nothing like seeing a demo with code. There are many D3 examples online but I have not seen such a big list published anywhere so I am dropping it below, with thumbnail images of each D3 demo on link mouseover. Here are 1,134 D3 examples:

http://techslides.com/over-1000-d3-js-examples-and-demos/

D3.js – Data-Driven Documents

By polfilm,

airportsD3.js is a JavaScript library for manipulating documents based on data. D3 helps you bring data to life using HTML, SVG and CSS. D3’s emphasis on web standards gives you the full capabilities of modern browsers without tying yourself to a proprietary framework, combining powerful visualization components and a data-driven approach to DOM manipulation.

http://d3js.org/

Zabbix Chef role sequence

By polfilm,

Get new Zabbix cookbook from GIT:
https://github.com/laradji/zabbix

Setup Role in Chef

0 	database::mysql
1 	mysql::server
2 	apache2
3 	apache2::mod_php5
4 	zabbix
5 	zabbix::database
6 	zabbix::server
7 	zabbix::web_apache

Manual steps had to be done to get it to work in Ubuntu 12.04

chmod 0775 /var/run/zabbix
chmod 0775 /var/log/zabbix

 

Ruby – Parse XML or Build XML

By polfilm,

To parse an XML string:

require 'xml'

xml = '<?xml version="1.0"?><root><child attr="value">text</child></root>'
root = XML::Parser.string(xml).parse.root
child = root.children.find { |node| node.name == "child" }
attr = child["attr"]

To build an XML document:

require 'xml'

xml = XML::Document.new
root = XML::Node.new("root")
child = XML::Node.new("child", "text")
child["attr"] = "value"
root << child
xml.to_s

Chef Server Name Not Resolved During Cookbook Upload [fix]

By polfilm,

Occurs when FQDN of the server is not resolvable on local network.
On chef server, create file called /etc/chef-server/chef-server.rb, and added below lines…

server_name = "192.168.56.11"
api_fqdn server_name
nginx['url'] = "https://#{server_name}"
nginx['server_name'] = server_name
lb['fqdn'] = server_name
bookshelf['vip'] = server_name

Then, run chef-server-ctl reconfigure.

Chef Solo Pattern with Berkshelf

By polfilm,

http://spin.atomicobject.com/2013/01/03/berks-simplifying-chef-solo-cookbook-management-with-berkshelf/
https://github.com/englishm/chef-solo-pattern
Chef – berkshelf lesson for dummies like me Ermahgerd!
http://leonard.io/blog/2012/05/installing-ruby-1-9-3-on-ubuntu-12-04-precise-pengolin/
https://github.com/opscode/nagios-quick-start
http://stackoverflow.com/questions/14173701/chef-upload-and-re-apply-a-cookbook-to-a-node

NodeBox for Python

By polfilm,

Using our open-source tools enable designers to automate boring production challenges, visualize large sets of data and access the raw power of the computer without thinking in ones and zeroes. Tools integrate with traditional design applications and run on many platforms.

http://nodebox.net/

Pattern for Python

By polfilm,

Pattern is a web mining module for the Python programming language.

It bundles tools for data mining (Google + Twitter + Wikipedia API, web crawler, HTML DOM parser), natural language processing (part-of-speech taggers, n-gram search, sentiment analysis, WordNet), machine learning (vector space model, k-means, k-NN, SVM) and network analysis (graph centrality & visualization).

http://www.clips.ua.ac.be/pages/pattern

Mirror TFS to GIT with History

By polfilm,

First Download Git-TF for VS TFS 2012

mkdir TFS
cd TFS
git-tf clone --bare --deep http://192.168.1.xxx:8080/tfs/CollectionName/ $/ProjectSourceName01
mkdir ProjectSourceName01Tmp
git clone --bare ProjectSourceName01 ProjectSourceName01Tmp
cd ProjectSourceName01Tmp
git push --mirror ssh://git@192.168.1.yyy/ProjectSourceName01.git

Then to clone back and double check it works

mv ProjectSourceName01 old-ProjectSourceName01
mv ProjectSourceName01Tmp old-ProjectSourceName01
git clone ssh://git@192.168.1.yyy/ProjectSourceName01.git

Mirror SVN to GIT with History

By polfilm,

This is actually a quite simple procedure:

apt-get install git git-svn
mkdir SVN
cd SVN
mkdir Project01
mkdir Project01Tmp
git svn clone --stdlayout --no-metadata -A users.txt https://192.168.1.xxx:8443/svn/Project01/ Project01
cd..
git clone --bare Project01 Project01Tmp
cd Project01Tmp
git push --mirror ssh://git@192.168.1.yyy/Project01.git
mv Project01 old-Project01
mv Project01Tmp old-Project01Tmp
git clone ssh://git@192.168.1.yyy/Project01.git

users.txt file should be in the following format

user1=First Last <first.last@example.com>
VisualSVN Server = Visual SVN Server <svn@example.com>

Webmin Add System User and Roles

By polfilm,
===== Add User =====
/etc/webmin/miniserv.users

===== Add Roles for User =====
/etc/webmin/webmin.acl

Note: nano line cut (CTRL-K) nano paste (CTRL-U)