Skip to content

Instantly share code, notes, and snippets.

View shurkin18's full-sized avatar
🏠
Working from home

Aleksandr Kamenev shurkin18

🏠
Working from home
View GitHub Profile
@shurkin18
shurkin18 / read_from_txt-file_append_to_csv-file.py
Last active July 11, 2023 15:31
Python script which will read a number from temp file, then append it to CSV file (I use this for my tradingbot to collect and store daily trading results)
from datetime import datetime
import time
import os
import pytz
########################################################################################################################
# THIS PROGRAM WILL READ a NUMBER FROM TEMP FILE, THEN PLACE THAT NUMBER INTO A CSV (APPEND) FILE WITH DATE/TIME STAMP #
#
# NOTE: You may need to modify permissions/ownership of the folder where the files will be located
# To find out which user the python script is running as, comment out everything and just add these 2 lines:
@shurkin18
shurkin18 / Apple-Automated-Updates-Deferral-JIRA-Ticket.sh
Last active July 11, 2023 15:49
Apple Mac System Updates automated script with deferrals, which will create a JIRA ticket after last deferral
#!/bin/bash
############################################################################################################################
# NOTE1: You will need to supply the JIRA API credentials down below under "JIRA API credentials and Issue Category" section
# NOTE2: You will need to modify the issue type id variable "mm_jira_cloud_it_tic_issue_type" (# Issue Type can be found in
# JIRA > Administration > Issues > Issue Types > copy link of Edit button next to the issue type and there will be ID at the end)
# NOTE3: You can modify the ticket creation wording for the summary and description, however make sure you match the issue/ticket
# presence check section as well, as it uses specific wording in the issue/ticket summary ("AUTOMATED TICKET") and the Reporter,
# so that if 1 issue/ticket is already created for the user > it will not keep creating more similar tickets!
# The rest of the script you can leave intact
@shurkin18
shurkin18 / JIRA-Cloud-api-ticket-create.sh
Last active July 6, 2023 21:32
Search JIRA Cloud for specific Issue and if none found - creates a new Issue via API
#!/bin/bash
####################################################################################################################################
# NOTE: you will need to generate a token (https://id.atlassian.com/manage-profile/security/api-tokens and click "Create API token")
# Make sure that account has necessary access (JIRA groups) on the JIRA's end, especially if you will be creating tickets via API
# In this example, we will search JIRA for issues with a specific title and specific reporter
# and if nothing found the script will create a new issue/ticket under Project "IT" and a specific Issue Type ID we set, assigned (Reporter) to currently logged in user (NOTE: this is for mac only), with specific Issue title and description
####################################################################################################################################
####################################################################################################################################
@shurkin18
shurkin18 / JIRA-OnPrem-api-ticket-create.sh
Last active November 10, 2023 03:54
Search JIRA On-Prem for specific Issue and if none found - creates a new Issue via API
#!/bin/bash
# Please note: JIRA URL may be different for your setup, including all of the URL
# https://COMPANY-JIRA-URL.com/jira/rest/api/2/issue/ | you may need to play around with it to get it exact right
currentLoggedInUser=`stat -f '%u %Su' /dev/console | awk '{ print $2 }'`
echo "Currently logged in user is: $currentLoggedInUser"
#Create JIRA API ticket
curl \
@shurkin18
shurkin18 / mount-dmg-install-cleanup.sh
Last active August 26, 2022 15:42
Mounts the DMG, then runs/installs the installer inside it, then cleans up
#!/bin/bash
# Variables, dmgPath is where the DMG installer will be located and the packageName is the installer inside the DMG,
# usually it's someting like Install.pkg or Install.mpkg, you need to know what it is and supply it to "packageName" variable
# Update these variables based on the DMG/installer you will be using this script on
dmgPath="/Users/Shared/Application.dmg"
packageName="Install.pkg"
################################################################
@shurkin18
shurkin18 / installbrewthenloadjq.sh
Last active May 23, 2023 11:55
Installs brew via script, then installs/loads jq JSON parser
###########################################################################################
# There is also an alternative way of running jq JSON parser, without installing the whole brew suite
# You can download the jq binary here: https://techstoreon.com/files/jq-osx-amd64
# Pre-load it to each mac via the policy and store it somewhere (in /var for example) and just point your script to it
# every time jq needs to be used
###########################################################################################
#!/bin/bash
# Checks if jq is not already present, and if not - installs brew via script, then installs/loads jq JSON parser
#
@shurkin18
shurkin18 / druvainsyncremoval.sh
Created October 8, 2021 02:41
Removes Druva inSync client completely including Keychain Access Manager entires, which prevent from re-activating it on the current mac
#!/bin/bash
set +x
user=`ls -l /dev/console | awk '//{print $3}'`
echo "loggedInUser:" $user
echo " Stopping inSync Client."
killall inSync
killall inSyncDecommission
@shurkin18
shurkin18 / druvainsyncactivationstatus.sh
Last active October 3, 2023 21:45
Checks if Druva inSync client is Active using UAPI and returns the status which can be used as JSS Computer Extension Attribute
#!/bin/bash
##########################################################################################################################################################################
##########################################################################################################################################################################
# Please note: this script requires jq JSON parser to be installed on the mac, otherwise the script won't work
# You can install jq JSON parser using brew by running this script, which will install brew and jq automatically (non-interactive):
# https://gist.github.com/shurkin18/62ec34967794a32f9d63615db881ab5c
#
# There is also an alternative way of running jq JSON parser, without installing the whole brew suite
# You can download the jq binary here: https://techstoreon.com/files/jq-osx-amd64
@shurkin18
shurkin18 / setmacnameonJSS
Created September 10, 2021 18:07
JAMF UAPI script which will ask the user for computer name and update it on JSS and locally
#!/bin/bash
#################################################################################################################
# Update the following variables as needed: "apiUser", "apiPass", "apiURL"
#################################################################################################################
# server connection information
jssurl="API URL"
username="API USERNAME"
password="API PASSWORD"
@shurkin18
shurkin18 / laps-initialize.sh
Last active October 3, 2023 21:45
JAMF UAPI LAPS initialization script which will set LAPS Computer Extension Attribute to a desired password
#!/bin/bash
#################################################################################################################
# This script can be used together with: https://gist.github.com/shurkin18/b8de3de44b184f1f8802b860639a9b4d
#################################################################################################################
# Please note: this script requires jq JSON parser to be installed on the mac, otherwise the script won't work
# You can install jq JSON parser using brew by running this script, which will install brew and jq automatically (non-interactive):
# https://gist.github.com/shurkin18/62ec34967794a32f9d63615db881ab5c
#
# There is also an alternative way of running jq JSON parser, without installing the whole brew suite