This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################### | |
## | |
## Alertmanager YAML configuration for routing. | |
## | |
## Will route alerts with a code_owner label to the slack-code-owners receiver | |
## configured above, but will continue processing them to send to both a | |
## central Slack channel (slack-monitoring) and PagerDuty receivers | |
## (pd-warning and pd-critical) | |
## |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# primary_user.rb | |
Facter.add("primary_user") do | |
setcode do | |
%x{if [ -f /usr/bin/ac ]; then /usr/bin/ac -p | /bin/sort -nk 2 | /bin/awk '/total/{print x};{x=$1}';fi}.chomp | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Trigger an update of MAS (and softwareupdate) apps | |
# | |
# This seems to be all that's needed to schedule an immediate update of | |
# MAS apps. This should be run as a normal user. You can run this and | |
# tail the install log to get an idea of what's happening. | |
# | |
# You can also take a look at this user's ~/Library/Caches/com.apple.storagent | |
# directory to get a report on what apps were available, installable, etc. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require './hash_inverse' | |
describe Hash do | |
describe "when empty and asked for the inverse" do | |
it "returns an empty hash" do | |
{}.inverse.must_equal Hash.new | |
end | |
end | |
describe "when mapping are unique and asked for the inverse" do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This method gets an already-prepared password string fed as the variable 'password_hash' | |
@@users_plist_dir = '/var/db/dslocal/nodes/Default/users' | |
if File.exists?("#{@@users_plist_dir}/#{resource_name}.plist") | |
# If a plist already exists in /var/db/dslocal/nodes/Default/users, then | |
# we will need to extract the binary plist from the 'ShadowHashData' | |
# key, log the new password into the resultant plist's 'SALTED-SHA512' | |
# key, and then save the entire structure back. | |
users_plist = Plist::parse_xml(`plutil -convert xml1 -o /dev/stdout #{@@users_plist_dir}/#{resource_name}.plist`) |
Password Hash Accessing:
-
Grab plist file from /var/db/dslocal/nodes/Default/users/username.plist
-
Convert to xml
plutil -convert xml1 username.plist
-
Grab the ShadowHashData key and base64 decode it (install base64 with port install base64)
echo "Data from ShadowHashData Key" | base64 -d > ShadowHashData
-
Convert the resultant binary plist file into xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
This file is executed when the Python interactive shell is started if | |
$PYTHONSTARTUP is in your environment and points to this file. It's just | |
regular Python commands, so do what you will. Your ~/.inputrc file can greatly | |
complement this file. | |
Modified from sontek's dotfiles repo on github: | |
https://github.com/sontek/dotfiles | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'james' | |
# This is a very simple James example for MacRuby. | |
# | |
# James is a voice controlled butler: | |
# http://github.com/floere/james | |
# | |
# Run using: | |
# 1. gem install james |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is how you can get a user's location using MacRuby and CoreLocation | |
framework 'CoreLocation' | |
def locationManager(manager, didUpdateToLocation: new_location, fromLocation: old_location) | |
puts "location: #{new_location.description}" | |
exit | |
end | |
loc = CLLocationManager.alloc.init | |
loc.delegate = self |
NewerOlder