Skip to content

Instantly share code, notes, and snippets.

import math
def string_norm(s):
return math.sqrt(sum(ord(c) ** 2 for c in s if c != ' '))
def anagram_detection(s1,s2):
return string_norm(s1) == string_norm(s2)
s1 = input("Please enter first string: ").lower()
s2 = input("Please enter second string: ").lower()
#! /bin/python
# 7 minutes Ansible module to list groups in inventory (Python version) :D
# You can print output like "pretty-print" outside Ansible by using:
#./listgroups /path/to/ansible.cfg | python -m json.tool
import sys
import re
import json
#get hosts inventory from ansible.cfg file.
(function($) {
function addUL(parent) {
var $ul = $("<ul/>");
var baseId = "_" + $(parent).attr("id");
$(parent).children("option,optgroup").each(function(index, tag) {
if (tag.tagName.toLowerCase() === "option") {
var $option = $(this);
var id = baseId + index;
var $li = $("<li/>").appendTo($ul);