Ubuntu New User

By polfilm,
sudo useradd -d /home/<username> -s /bin/bash -m <username>
sudo passwd <username>
sudo adduser <username> sudo

Ipa. Change Admin Password

By polfilm,
LDAPTLS_CACERT=/etc/ipa/ca.crt ldappasswd \
           -ZZ -D 'cn=directory manager' -W \
           -S uid=admin,cn=users,cn=accounts,dc=domain,dc=com


Authenticating as principal admin/admin@EXAMPLE.COM with password.
kadmin.local:  change_password admin@EXAMPLE.COM
Enter password for principal "admin@EXAMPLE.COM": 
Re-enter password for principal "admin@EXAMPLE.COM": 

Fedora 20. Set hostname permanently.

By polfilm,

1.Set the hostname in /etc/hostname

2. Edit /etc/cloud/cloud.cfg (which is a YAML file) and set preserve_hostname: true at the toplevel (one can also pass this option in with the user data)

Check SSH keypair fingerprint

By polfilm,


ssh-keygen -lf ~/.ssh/id_rsa.pub


openssl x509 -noout -fingerprint -in /etc/ssl/certs/ssl-cert-snakeoil.pem

Git: Few Good Commands

By polfilm,

To move repo with history

git clone --bare <old_repo>
cd into bare old_repo and: git push --mirror <new_repo>

To clone from HTTPS with self-generated cert

git -c http.sslVerify=false clone https://<repo>

Restore all deleted files in folder

git ls-files -d | xargs git checkout --

Automatic Versioning
Begin Versioning:

git tags -a 2.1


git describe --tags

Result similar to this where 411 is number of commit for above given tag.


  Category: GIT
  Comments: None

UI Frameworks

By polfilm,

Don’t even think about starting work on UI without looking at those…


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