Skip to content

Instantly share code, notes, and snippets.

@opragel
opragel / google_drivefs_update_checker.py
Last active October 4, 2017 22:55 — forked from bruienne/google_chrome_update_checker.py
Fork of Chrome update query for DriveFS
#!/usr/bin/python
import xml.etree.ElementTree as ET
import requests
import uuid
params = {'cup2hreq': 'foo', 'cup2key': 'bar'}
platform = 'mac'
os_version = '10.12'

iOS, The Future Of macOS, Freedom, Security And Privacy In An Increasingly Hostile Global Environment

This post by a security researcher who prefers to remain anonymous will elucidate concerns about certain problematic decisions Apple has made and caution about future decisions made in the name of “security” while potentially hiding questionable motives. The content of this article represents only the opinion of the researcher. The researcher apologises if any content is seen to be inaccurate, and is open to comments or questions through PGP-encrypted mail.



TL;DR

@opragel
opragel / fastuser_logincheck.py
Last active April 26, 2016 17:47 — forked from pudquick/fastuser_logincheck.py
Using CGSSessionCopyAllSessionProperties to detect logged-in users the way the Fast User switching menu extra does on OS X with python and pyobjc
import objc
from Foundation import NSBundle
CG_bundle = NSBundle.bundleWithIdentifier_('com.apple.CoreGraphics')
functions = [("CGSSessionCopyAllSessionProperties", b"@"),]
objc.loadBundleFunctions(CG_bundle, globals(), functions)
allSessionProperties = CGSSessionCopyAllSessionProperties()
for session in allSessionProperties:
@opragel
opragel / run_launchagent_as_user.sh
Last active April 5, 2016 18:48
Script to run LaunchAgent as the logged-in user from a script run with root privileges
#!/bin/bash
LAUNCH_AGENT_PATH="/Library/LaunchAgents/com.pritunl.client.plist"
currentUser=$(python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "\n");')
currentUserPID=$(pgrep WindowServer -m1)
currentUserUID=$(id -u "$currentUser")
osvers=$(sw_vers -productVersion | awk -F. '{print $2}')
if [[ $EUID -ne 0 ]]; then
@opragel
opragel / achotfix.sh
Last active February 18, 2016 10:34
Deploy ArchiCAD hotfixes silently, from a URL
#! /usr/bin/env bash
# borrowed from @filipp's gist: https://gist.github.com/filipp/8975071
# sh <(curl -fSsk https://gist.githubusercontent.com/filipp/8975071/raw) https://example.com/hotfix.dmg
MOUNTPOINT=/tmp/InstallACFix
CACHEDIR=$(getconf DARWIN_USER_CACHE_DIR)
if [[ $# -eq 0 ]]; then
echo "Usage: $(basename "$0")" url_to_dmg 2>&1
exit 0
else
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
green='\033[0;32m'