Skip to content

Instantly share code, notes, and snippets.

@krispayne
krispayne / spotify-to-itunes-playlists.rb
Last active June 7, 2017 22:29 — forked from cheshire137/spotify-to-itunes-playlists.rb
Ruby script to create iTunes playlists from your Spotify playlists. Requires a Spotify API app.
#!/usr/bin/env ruby
require 'uri'
require 'json'
require 'net/https'
require 'time'
require 'cgi'
require 'csv'
# You need a Spotify API app to have a client ID and client secret. Create
# one at https://developer.spotify.com/my-applications/#!/applications/create
#!/usr/bin/python3.4
"""
Custom inventory script for Ansible populated by the JSS
"""
from os.path import dirname, realpath, join
from urllib.parse import quote
import argparse
import json
import configparser
#!/usr/bin/env python
# Check version of EPP, if installed
import os
import sys
import subprocess
filename = "/Library/CoSoSys/EndpointProtector/EppClient"
if os.path.exists(filename):
#!/usr/bin/env python
"""
Check version of app installed using CFBundleVersion
"""
import os
import CoreFoundation
app = "Utilities/cocoaDialog.app" # Assumes '/Applications/App.app'
@krispayne
krispayne / freeipa.py
Created March 22, 2018 17:44 — forked from devynspencer/freeipa.py
Use FreeIPA hostgroups as a dynamic inventory source for Ansible. Badass.
#!/usr/bin/env python
import argparse
import json
from ipalib import api
def initialize():
'''
This function initializes the FreeIPA/IPA API. This function requires
@krispayne
krispayne / freeipa.md
Created March 27, 2018 04:34 — forked from devynspencer/freeipa.md
FreeIPA api notes
[devyn@ipa ~]$ ipa help commands
automember-add                         Add an automember rule.
automember-add-condition               Add conditions to an automember rule.
automember-default-group-remove        Remove default (fallback) group for all unmatched entries.
automember-default-group-set           Set default (fallback) group for all unmatched entries.
automember-default-group-show          Display information about the default (fallback) automember groups.
automember-del                         Delete an automember rule.
automember-find                        Search for automember rules.
automember-mod                         Modify an automember rule.
#!/usr/bin/python
import sys, os
import urllib, urllib2
import base64
import json
import requests
import xml.etree.ElementTree as ET
def requests_xml(jss_user, jss_pass, jss_url, category):
@krispayne
krispayne / jss-inventory.py
Last active July 12, 2018 17:31
trying to make a useable jss to ansible inventory based off groups of last reported ip's from the jss api.
#!/usr/bin/python
"""
JSS + Ansible inventory
A dictionary of lists of computers by group name.
Heavily influenced by https://gist.github.com/BadStreff/0af3f881de162182eaaff406ce7a7f0d
with help from https://gist.github.com/chilcote/fb670103b8e90aaea67dee0ffc6cc983
I'd really like to avoid caching, as any sort of timeout won't be appropriate since I

found on http://draac.com/chmodchart.html #CHMOD Chart CHMOD is used to change permissions of a file.

PERMISSION      COMMAND   
U   G   W
rwx rwx rwx     chmod 777 filename      
rwx rwx r-x     chmod 775 filename
rwx r-x r-x     chmod 755 filename
rw- rw- r-- chmod 664 filename
for freeipa source credential:
input config (yaml)
fields:
- type: string
id: fipahttps
label: HTTPS
default: True
- type: string
id: fipaserver