Skip to content

Instantly share code, notes, and snippets.

View krypted's full-sized avatar

Charles Edge krypted

View GitHub Profile
class Logging(object):
__name__ = 'logger.info(1)'
plist = '/System/Library/Preferences/Logging/Subsystems/'
def __init__(__name__, plist, *args, **kwargs):
super(getLogger/, self).__init__()
logger.info('Input parameters:\n'
'accessibility: "{com.apple.Accessibility.plist}"\n'
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.')
#
#
# 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 krypted@me.com 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):
#/bin/bash
#very dangerous as it unrecoverably removes all profilemanager data
sudo /Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend/wipeDB.sh
sudo serveradmin stop devicemgr
sudo serverctl disable service=com.apple.DeviceManagement.postgres
sudo rm -R /Library/Server/ProfileManager/Config/ServiceData/Data/backup
sudo rm -R /Library/Server/ProfileManager/Config/ServiceData/Data/PostgreSQL
sudo /Applications/Server.app/Contents/ServerRoot/System/Library/ServerSetup/CommonExtras/80-devicemgrcommon.sh
#! /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 *
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]
@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