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\": \"\"}}" --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 (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 Then removed with gedit, resaved and…. upload success!

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

Full stack here:

Reported, here:

How to checkout Nova Folsom or Grizzly branch on github

By polfilm,

Clone branch directly

git clone --branch stable/grizzly

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
  remotes/origin/HEAD -> origin/master
 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

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:

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.

Zabbix Chef role sequence

By polfilm,

Get new Zabbix cookbook from GIT:

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| == "child" }
attr = child["attr"]

To build an XML document:

require 'xml'

xml =
root ="root")
child ="child", "text")
child["attr"] = "value"
root << child

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 = ""
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,
Chef – berkshelf lesson for dummies like me Ermahgerd!

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.

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).

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 $/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 Project01
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 <>
VisualSVN Server = Visual SVN Server <>

Webmin Add System User and Roles

By polfilm,
===== Add User =====

===== Add Roles for User =====

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