This file contains 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
#!/usr/bin/env python | |
import sys, re | |
# get first command line argument as filename | |
input_file = sys.argv[1] | |
# suck in file contents | |
with open(input_file) as f: | |
content = f.readlines() |
This file contains 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
display dialog "Please enter the account to give administrator privileges." default answer "" | |
set username to text returned of result | |
try | |
do shell script "/usr/sbin/dseditgroup -o edit -a 'DOMAIN\\" & username & "' -t user admin" with administrator privileges | |
set question to display dialog "Successfully granted administrator privileges to " & username & "." buttons {"Quit"} default button 1 | |
set answer to button returned of question | |
if answer is equal to "Quit" then | |
return | |
end if | |
on error |
This file contains 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
set testPass to text returned of (display dialog "Enter a test password:" default answer "" with hidden answer) | |
do shell script "/bin/echo '" & testPass & "' > /var/tmp/pass_file" | |
set echoedPass to (do shell script "/bin/cat /var/tmp/pass_file") | |
display dialog "This is what you typed: | |
" & testPass & " | |
This is what AppleScript echoed to a temp file: | |
" & echoedPass |
This file contains 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
exec { 'patch_shellshock_security_hole': | |
command => "/usr/bin/yes | /usr/bin/yum update bash; touch /root/shellshock_bug_has_been_patched", | |
creates => '/root/shellshock_bug_has_been_patched', | |
} |
This file contains 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/bash | |
for vol in /Volumes/*; do | |
if [ -e "${vol}/System/Library/CoreServices/boot.efi" ]; then | |
echo "Partition info for Mac bootable volume:" | |
diskutil list "${vol}" | |
# more stuff here | |
elif [ -e "${vol}/Windows/System32/winload.exe" ]; then | |
echo "Partition info for Win bootable volume:" | |
diskutil list "${vol}" |
This file contains 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
class cluster::scratchroot { | |
file { '/scratch': | |
ensure => directory, | |
owner => 'root', | |
group => 'root', | |
mode => '0755', | |
} | |
} | |
define cluster::scratchdir( $u, $g, $m ) { |
This file contains 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
define hdfsstruct ($mountpoint = $name, $device) { | |
file { "$mountpoint": | |
ensure => directory, | |
} | |
exec { "format-$device": | |
command => "/sbin/mkfs.ext4 $device", | |
unless => "/bin/mount | /bin/grep $device", | |
refreshonly => true, | |
} | |
mount { $mountpoint: |
This file contains 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
dscl /Search read /Users/$USER AuthenticationAuthority | egrep -o "[A-Z0-9._%+-]+@[A-Z0-9.-]+\.(?:[A-Z]{2}|com|org|net|edu|gov|mil|biz|info|mobi|name|aero|asia|jobs|museum)" |
This file contains 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
#!/usr/bin/pythonw | |
from Tkinter import Tk | |
from tkSimpleDialog import askstring | |
def passPrompt(title, prompt): | |
"""Prompts for a password.""" | |
password = askstring(title, prompt, show="*") | |
print "Seriously? '" + password + "'?? That's a lame password." |
This file contains 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
#!/usr/bin/python | |
# | |
# Simple python example of a Pashua password prompt window with a checkbox | |
# for saving the password to the keychain. None of it is wired up to | |
# actually function. It's just an example of what you can do. | |
# | |
# For easiest testing, you should have the Pashua.py connector and Pashua.app | |
# in the same directory as this script. | |
# | |
# The test password is 'password'. |
OlderNewer