Skip to content

Instantly share code, notes, and snippets.

View SimonGreenhill's full-sized avatar
🐒

Simon J Greenhill SimonGreenhill

🐒
View GitHub Profile
@kevinushey
kevinushey / enumerate.R
Last active June 14, 2024 10:13
A python-style enumerate function for R.
enumerate <- function(X, FUN, ...) {
result <- vector("list", length(X))
for (i in seq_along(result)) {
tmp <- FUN(X[[i]], i, ...)
if (is.null(tmp))
result[i] <- list(NULL)
else
result[[i]] <- tmp
}
result
@lokkju
lokkju / find_system_python_dylibs.sh
Last active December 31, 2023 23:08
This script prints the filenames of any libs in your /usr/local/lib that depend on the System Python. It is especially useful if you use a non-system Python, but have previously compiled extensions against the System Python - it will tell you which need to be recompiled.
#!/bin/bash
echo "This script prints the filenames of any dylibs in your /usr/local/ that depend on the System Python"
for f in `find /usr/local/lib`; do
otool -L "$f" 2> /dev/null| grep Python | grep System &> /dev/null
status=$?
if [ $status -eq 0 ]; then
echo "$status: $f"
fi
done
@SimonGreenhill
SimonGreenhill / crashplan.sh
Created June 25, 2012 23:47
Shell script to start and stop crashplan
#!/bin/sh
USER=~/Library/LaunchAgents/com.crashplan.engine.plist
SYSTEM=/Library/LaunchDaemons/com.crashplan.engine.plist
if [ -f $SYSTEM ]
then
PLIST=$SYSTEM
elif [ -f $USER ]
then