Skip to content

Instantly share code, notes, and snippets.

View krypted's full-sized avatar

Charles Edge krypted

View GitHub Profile
import random
card_colors=['red','black','blue','green','white']
op_hp = 20
player_hp = 20
while op_hp >0 and player_hp >0:
run_or_attack = input('Do you want to run (run) or use a magic card (use)?')
if run_or_attack == 'run':
random_run = random.random()
if random_run > .3:
print ('You run away from the battle.')
#! /bin/bash
curl -s -u myuser:mypassword https://myserver.jamfcloud.com/JSSResource/computers | sed -n -e 's/.*<size>\(.*\)<\/size>.*/\1/p' curl -s -u myuser:mypassword https://myserver.jamfcloud.com/JSSResource/mobiledevices | sed -n -e 's/.*<size>\(.*\)<\/size>.*/\1/p'
mkdir pkg
cp -a source/. pkg/
while read lib; do
pip3 install $lib -t ./pkg
done <installedlibraries.txt
chmod -R +x ./pkg/
cd pkg
zip -r ../function.zip *
#
#
# Exports the contents of a flat sql dump to csv files with the name of the table.csv and a xls representation of the database
# Requires Python 3.7 (from a Mac, first - brew install python3)
# Prior to running python3 -m pip install pandas
# Prior to running python3 -m pip install openpyxl
# Usage python3 sqlcsvxlsexport.py <sql dump file> <target directory>
# Send accolades for the script to [email protected] or hatemail to <devnull>
#
#
import re
import csv
import sys
import os.path
import argparse
# allow large content in the dump
csv.field_size_limit(sys.maxsize)
def is_insert(line):
@krypted
krypted / gist:876b67b0d43469c11c245f1ad10e6ca1
Created January 23, 2019 20:31
jamf_smart_group_to_IFTTT_php
<?php
ini_set("error_log", "error.log");
error_reporting(E_ALL);
class IFTTT
{
protected $key = null;
protected $headers = array();
protected $input = null;
protected $params = array();
if [[ $(/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -dump | grep usrnode
) ]]; then
echo "<result>WindTail Detected</result>"
else
echo "<result>Not Detected</result>"
fi
#!/bin/sh # # # #Jamf Pro Extension Attribute to return the UID of a device in Splashtop # #
result=`defaults read ~/Library/Preferences/com.splashtop.stb.macosx.plist uniqueIdentifier`
echo "<result>$result</result>"
tell application "Calendar"
set allEvents to events of calendar "SOURCE"
repeat with theEvent in allEvents
copy theEvent to end of events of calendar "TARGET"
delete theEvent
end repeat
end tell
import requests
from xml.etree import ElementTree as ET
import sys
print("Script Starting...")
print("")
# Set the following constants specific to Salesforce Environment
username = sys.argv[1]
password = sys.argv[2]