Skip to content

Instantly share code, notes, and snippets.

@acoomans
acoomans / mdm_check.sh
Created April 18, 2024 01:49 — forked from arainho/mdm_check.sh
Check whether DEP is present and MDM enrollment is user-approved.
#!/usr/bin/env bash
# Check if a machine was enrolled via DEP (10.13+)
# Show whether a machine has a device enrollment profile (DEP) present (10.13.0+),
# and if the MDM enrollment is user approved (10.13.4+)
/usr/bin/profiles status -type enrollment
# Checking for a DEP profile on macOS
# Display the DEP profile for a macOS device in 10.13 and above:
sudo /usr/bin/profiles show -type enrollment
// import the profiler (be sure to use our Profiler and not React's):
import { Profiler } from 'profiler/profiler';
// Wrap the desired component with our Profiler component
<Profiler
component="ComponentToProfile"
id={someId}
>
<ComponentToProfile>...</ComponentToProfile>
@acoomans
acoomans / chromium.bash
Last active September 9, 2020 19:12
Building Chromium
#!/bin/sh
echo "Checking out source code"
# https://chromium.googlesource.com/chromium/src/+/master/docs/mac_build_instructions.md#Running-test-targets
cd $HOME/src
mkdir chromium && cd chromium
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH="$PATH:$HOME/src/chromium/depot_tools"
@acoomans
acoomans / pihole.md
Created November 27, 2019 05:18
Pi-hole as WiFi AP

SSD card

On the ssd card:

touch ssh

Rasberry Pi

Log in:

@acoomans
acoomans / pre-commit
Created May 21, 2019 05:39
Git pre-commit hook
#!/bin/sh -x
# Run git config --global core.hooksPath /path/to/hooks
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
against=$(git hash-object -t tree /dev/null)
fi
@acoomans
acoomans / GetBundleIdentifier.py
Created April 22, 2019 15:33
LLDB Python helper
def GetBundleIdentifier(debugger):
debugger.GetSelectedTarget().GetProcess().GetThreadAtIndex(0).GetSelectedFrame()
options = lldb.SBExpressionOptions()
options.SetLanguage(lldb.eLanguageTypeSwift)
bundle_identifier = frame.EvaluateExpression('Bundle.main.bundleIdentifier', options).description.translate(None, '"').strip()
if not bundle_identifier:
bundle_identifier = "no-bundle-id"
debug('bundle_identifier = ' + bundle_identifier)
return bundle_identifier
@acoomans
acoomans / cache.py
Created April 22, 2019 15:33
Python decorators
def cache(f):
'''Memorizes the return value for a function regardless arguments beyond the first one.'''
class cache:
UNSET = 'unset'
def __init__(self, f):
self.f = f
self.ret = cache.UNSET
def __call__(self, *args, **kwargs):
if self.ret == cache.UNSET:
self.ret = self.f(*args, **kwargs)
@acoomans
acoomans / lldb_screengraph.py
Created April 18, 2019 01:41
LLDB screengraph
#!/usr/bin/python
# ---------------------------------------------------------------------
# Be sure to add the python path that points to the LLDB shared library.
#
# # To use this in the embedded python interpreter using "lldb" just
# import it with the full path using the "command script import"
# command
# (lldb) command script import /path/to/lldb_screengraph.py
# ---------------------------------------------------------------------
@acoomans
acoomans / git-contains.sh
Created March 1, 2019 20:42
Development scripts
#!/bin/bash
# search remote branches for a pattern
GREP_PATTERNS=$@
if [ -z "$GREP_PATTERNS" ] ; then
echo "Need a term to search for, like a diff number."
exit 1
fi
## ESP32
# https://docs.espressif.com/projects/esp-idf/en/latest/get-started/
git clone --recursive https://github.com/espressif/esp-idf.git
pip install -r esp-idf/requirements.txt
export IDF_PATH="$HOME/src/esp-idf"
# start project