Skip to content

Instantly share code, notes, and snippets.

View tsarenkotxt's full-sized avatar
💻

Andrii Tsarenko tsarenkotxt

💻
  • Ukraine
View GitHub Profile
@tsarenkotxt
tsarenkotxt / AutoVPN.md
Last active March 31, 2022 17:04
Mac OS VPN auto connect and reconnect, for a specific user, with notifications
  1. Create a python script, and save as auto_vpn.py in the ~/Documents directory

it is not necessary to use this file name and directory, but it is used in the following steps

auto_vpn.py

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import os
import time
@tsarenkotxt
tsarenkotxt / command-executor.md
Last active April 18, 2022 14:02
Python execute shell commands (unix)

A simple function to execute shell commands (unix):

import os, signal, subprocess


def execute(command, timeout=None):
    process = subprocess.Popen(command,
                               stdout=subprocess.PIPE, stderr=subprocess.STDOUT, start_new_session=True, shell=True)
 try:
@tsarenkotxt
tsarenkotxt / Fix Xcode stuck on install or update.md
Last active December 14, 2022 14:30
Fix Xcode stuck on install or update
  1. check installation logs:
cat /var/log/install.log
  1. find the issue:
...
2022-04-26 22:50:21+03 tsarenkotxt installd[1641]: PackageKit: Extracting file:///var/folders/8x/_h18ksqn64dgswlstgcd_fw40000gn/C/com.apple.appstoreagent/com.apple.appstore/0C4C5EA3-A445-4CF0-9E44-37938052A4D9/kwb3255311556092828694.pkg#Xcode.pkg (destination=/Library/InstallerSandboxes/.PKInstallSandboxManager/7A629BA6-7537-469C-8C19-C74DD52245A1.activeSandbox/Root, uid=0)
2022-04-26 23:03:05+03 tsarenkotxt installd[1641]: PackageKit: Removing client PKInstallDaemonClient pid=3827, uid=501 (/System/Library/PrivateFrameworks/AppStoreDaemon.framework/Support/appstoreagent)