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
mydataitem: | |
- username: "butts" | |
- pass: "lol" |
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
# You have a proprietary file system type (myfs) with a custom set of command line tools. | |
# You need to clean up all files with a modification time older than 24 hours. | |
# Any directories left empty as a result of this cleanup should also be removed as well. | |
# | |
# The command to list a directory is 'myfs ls' | |
# The command to list a directory recursively is 'myfs lr' | |
# The command to delete a file or directory is 'myfs rm' | |
# | |
# The root uri of the filesystem is 'myfs://myserver/' | |
# |
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 sudoers::add_sudoer ( | |
$theguy = $name, | |
$pass = '', | |
# variables here | |
) { | |
realize(Concat['/etc/sudoers']) | |
concat::fragment { $theguy: | |
target => '/etc/sudoers', | |
content => "${theguy} ALL=(ALL:ALL) NOPASSWD:ALL", | |
order => 90, |
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
require 'google/api_client' | |
def gsearch(searchstr, ftype: 'jpg', start: nil, depth: nil) | |
puts "Entering function with depth: \"#{depth}\"" | |
client = Google::APIClient.new(:application_name => 'IRC Bot Search Helper', | |
:application_version => '0.0.1', | |
:client_id => cid, | |
:client_secret => cs, | |
:authorization => nil) | |
search = client.discovered_api('customsearch') |
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 BaseModel(Model): | |
class Meta: | |
database = psql_db | |
# There can be a lot of Alerts that come in. | |
# Each Alert can "have" many users | |
class Alert(BaseModel): | |
alertId = CharField(unique = True, primary_key = True) | |
alertLink = Charfield(unique = True) | |
startTime = TimeField() |
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
def dice_roll(dicestr) | |
sets = dicestr.scan(/[0-9]+d[0-9]+/) | |
modifier = dicestr.scan(/for \w+ modifier ([+-])(\d+)/) | |
if !modifier.empty? | |
puts "Modifier is NOT empty\n\n" | |
if modifier[0][0] == '-' | |
mod = "#{modifier[0][0]}#{modifier[0][1]}".to_i | |
else | |
mod = "#{modifier[0][1]}".to_i | |
end |
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
def getFromSite(self, search, contentonly = False, thingtype = 'contents'): | |
thingtypes = ['contents', 'places', 'people'] | |
if thingtype not in thingtypes: | |
thingtype = 'contents' | |
query = 'https://example.com/api/core/v3/search/{0}?filter=search("{1}")' | |
setquery = query.format(thingtype, search) | |
returnedpage = requests.get(setquery, | |
auth = (self.settings['user'], self.settings['pass']), | |
headers = {'content-type': 'application/json'}) | |
jsondata = ''.join(returnedpage.text.split('\n')[1:]) |
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 ldap | |
import sys | |
import threading | |
import argparse | |
import signal | |
import time | |
import os | |
import Queue | |
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 | |
import sys | |
try: | |
import yaml | |
except: | |
print 'You must first install pyyaml: `pip install pyyaml`' | |
sys.exit(1) | |
from argparse import ArgumentParser |
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
# modularize |
OlderNewer