Skip to content

Instantly share code, notes, and snippets.

View AlexRogalskiy's full-sized avatar
🛰️
Work on stuff that matters

Alexander AlexRogalskiy

🛰️
Work on stuff that matters
View GitHub Profile

Disable Device Enrollment Program (DEP) notification on macOS Catalina.md

  1. Boot to Recovery Mode by holding command-R during restart

  2. Open Tools → Terminal and type

$ csrutil disable
$ reboot
@AlexRogalskiy
AlexRogalskiy / disable.sh
Created April 21, 2022 08:29 — forked from stephengfriend/disable.sh
Disable bunch of #$!@ in Catalina
#!/bin/bash
# IMPORTANT: Don't forget to logout from your Apple ID in the settings before running it!
# IMPORTANT: You will need to run this script from Recovery. In fact, macOS Catalina brings read-only filesystem which prevent this script from working from the main OS.
# This script needs to be run from the volume you wish to use.
# E.g. run it like this: cd /Volumes/Macintosh\ HD && sh /Volumes/Macintosh\ HD/Users/sabri/Desktop/disable.sh
# WARNING: It might disable things that you may not like. Please double check the services in the TODISABLE vars.
# Get active services: launchctl list | grep -v "\-\t0"
# Find a service: grep -lR [service] /System/Library/Launch* /Library/Launch* ~/Library/LaunchAgents
@AlexRogalskiy
AlexRogalskiy / alias.vim
Last active March 18, 2022 13:42
Alias vim
set background=dark
highlight clear
let colors_name = "alias"
"Set environment to 256 colours
set t_Co=256
if version > 580
define(function () { 'use strict';
function log(...args) {
console.log('%ctype-challenges =>', 'color: teal', ...args);
}
function noop() { }
function is_promise(value) {
return value && typeof value === 'object' && typeof value.then === 'function';
}
@AlexRogalskiy
AlexRogalskiy / gist:32cbccd1e2b685659dd4fc7ac7b9f535
Created February 27, 2022 22:25
Get dependencies of compiled stuff
sudo apt-get install -y apt-file findutils mawk binutils
find -type f | xargs -L1 file | awk -F: '/ELF/{print$1}' | xargs -L1 readelf -d | awk '/\[[a-zA-Z_-\.0-9]*\]/{sub(/.*\[/,"");sub(/\].*/,"");print$0}' | xargs -L1 apt-file search | awk -F: '!/-dbg|-i386|lib32|gcc-snapshot/ && !($1 in a){a[$1];print $1}'
@AlexRogalskiy
AlexRogalskiy / bootstrap.sh
Created February 27, 2022 22:24
bootstrap dotfiles
#!/bin/sh
which git >/dev/null 2>&1
[ $? -ne 0 ] && echo "git required" && exit 1
git clone git://github.com/steakknife/dotfiles.git ~/.dotfiles
[ $? -ne 0 ] && echo "could not clone repo && exit 1
pushd . >/dev/null 2>&1
cd ~/.dotfiles
@AlexRogalskiy
AlexRogalskiy / gist:010f0780e59c61a328cc06fb8149f88a
Created February 27, 2022 22:23
Linux: find all library packages required by all binaries in the current subtree (can take 5-10 minutes)
find -type f -exec file {} \; \
| awk -F: '/ELF/{print$1}' \
| xargs -I% readelf -d % \
| awk '/Shared/{gsub("\\[","",$5);gsub("\\]","",$5);if(length($5)>1){x[$5]++}} END{for(i in x){print i}}' \
| xargs -L1 apt-file find \
| awk -F: '{x[$1]++} END{for(i in x){print i}}' \
| awk '!/32|-dbg$|-i386$/'
@AlexRogalskiy
AlexRogalskiy / gist:37159ac7d34304e4e124a5afb2f4c68f
Created February 27, 2022 12:26
If you ever happen to extract tz tarballs without a directory (LOL), this will help you clean up the directory.
find . -type f `find tz?(32|64){code,data}*\.tar\.{gz,Z} | xargs -I% echo "-name % -prune -o"` -type f -name '*' -exec \rm -i {} \;
@AlexRogalskiy
AlexRogalskiy / compare_shells
Created February 27, 2022 12:25
Compare the execution environment of numerous shells, both sourced and running a script.
#!/bin/sh
# creates env.{source|run}.SHELL, diff them for details for details.
# It is not fancy.
# Usage: compare_shells
for MY_SHELL in zsh rbash bash sh tcsh csh ksh dash; do
THE_SHELL=`which $MY_SHELL 2>/dev/null`
if [ -x "$THE_SHELL" ]; then
echo "$THE_SHELL"
echo "$THE_SHELL" | grep 'cs' >/dev/null && SRC='source' || SRC='.'
@AlexRogalskiy
AlexRogalskiy / gist:1e830f9e5f8892f0f9d16d15e8a9bf12
Created February 27, 2022 12:24
Turn on quotas on just the volumes that need it.
mount | grep '(rw.*quota.*)' | cut -d' ' -f3 | xargs -I% sh -exc "{ [ -e %/aquota.group ] && [ -e %/aquota.user ] ; } || quotacheck -cug %"