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/bash | |
#don't write shell scripts without this... | |
set -e | |
cd /my/folder | |
#Use timeout and flock to run your unreliable script every minute. Run only one copy. Useful against REST APIs for example | |
timeout --signal=KILL 59 flock -n /tmp/mycommand.lock -c 'mystupid long command' | |
#Log stdout and stderr. Discard stdout so cron doesn't mail you about it, but still receive mail for errors. |
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
class NestedDict(dict): | |
def __getitem__(self, key): | |
if key in self: return self.get(key) | |
return self.setdefault(key, NestedDict()) | |
#http://ohuiginn.net/mt/2010/07/nested_dictionaries_in_python.html retrieved 2014-05-09 | |
#Credit (and thanks) to Dan O'Huiginn | |
#could also use __missing__ instead: | |
class NestedDict(dict): |
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 only for OSX | |
#first, install git. http://git-scm.com/download/mac | |
cd ~/Library/Application\ Support/Steam/SteamApps/common/Kerbal\ Space\ Program/saves && git init | |
(crontab -l ; echo '*/5 * * * * cd ~/Library/Application\ Support/Steam/SteamApps/common/Kerbal\ Space\ Program/saves && git add -A && git commit -m "`date`" &> /dev/null') | crontab - | |
#confirm your crontab is good to go | |
crontab -l | |
##to revert |
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
def self.load(data_bag, name, secret = nil) #secret can be nil | |
raw_hash = Chef::DataBagItem.load(data_bag, name) #load the raw (encrypted) hash into a databag object | |
secret = secret || self.load_secret #if secret is specified, this or operator short circuits and returns the first value. if secret is nil, calls self.load secret (L7) | |
self.new(raw_hash, secret) #return a new object | |
end | |
def self.load_secret(path=nil) #again, path can be nil | |
path ||= Chef::Config[:encrypted_data_bag_secret] # a shortcut to saying path = path || Chef::Config... as L3 | |
if !path #nothing in path, means the default secret location wasn't set either. are you seeing this error? | |
raise ArgumentError, "No secret specified to load_secret and no secret found at #{Chef::Config.platform_specific_path('/etc/chef/encrypted_data_bag_secret')}" |
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
<< secret = Chef::EncryptedDataBagItem.load_secret(Chef::EncryptedDataBagItem::DEFAULT_SECRET_FILE) | |
<< splunk_auth_items = Chef::EncryptedDataBagItem.load("splunk_auth",node['splunk']['indexer_env'] + '_auth_creds',secret) | |
>> splunk_auth_items = Chef::EncryptedDataBagItem.load("splunk_auth",node['splunk']['indexer_env'] + '_auth_creds') |
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
diff --git a/.gitignore b/.gitignore | |
index fc5b76d..abf8a27 100644 | |
--- a/.gitignore | |
+++ b/.gitignore | |
@@ -1,4 +1,23 @@ | |
-.bundle | |
-.cache | |
-.kitchen | |
-bin | |
+_Store |
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
diff --git a/.gitignore b/.gitignore | |
index fc5b76d..abf8a27 100644 | |
--- a/.gitignore | |
+++ b/.gitignore | |
@@ -1,4 +1,23 @@ | |
-.bundle | |
-.cache | |
-.kitchen | |
-bin | |
+_Store |
NewerOlder