Skip to content

Instantly share code, notes, and snippets.

View andrewpetrochenkov's full-sized avatar
🔍

Andrew P andrewpetrochenkov

🔍
View GitHub Profile
@andrewpetrochenkov
andrewpetrochenkov / brew-pid.sh
Last active October 22, 2024 08:05
macOS brew pid #macos #brew
find /opt/homebrew/var -type f -name "*.pid"
find /opt/homebrew/var -type f -name "*.pid" -exec rm {} \;
@andrewpetrochenkov
andrewpetrochenkov / mac-docker.sh
Created October 17, 2024 14:00
macOS Docker #docker #mac
osascript -e 'quit app "Docker"' # stop
open -a Docker # start
docker info
@andrewpetrochenkov
andrewpetrochenkov / mac-tccutil.sh
Created October 17, 2024 13:19
macos tccutil #macos #tccutil
tccutil reset Camera
tccutil reset Microphone
tccutil reset Location
tccutil reset AddressBook
tccutil reset Calendar
tccutil reset Photos
tccutil reset Reminders
tccutil reset BluetoothAlways
tccutil reset SystemPolicyDocumentsFolder
@andrewpetrochenkov
andrewpetrochenkov / mac-squid.conf
Last active April 30, 2025 23:52
mac squid #mac #squid
# /opt/homebrew/etc/squid.conf
debug_options ALL,1 33,2
# 8.8.8.8 8.8.4.4 blocked in Russia
dns_nameservers 1.1.1.1 9.9.9.9
dns_v4_first on
visible_hostname localhost
@andrewpetrochenkov
andrewpetrochenkov / mac-squid.sh
Last active August 26, 2025 10:54
squid macos #squid
brew install squid
brew link --force squid
sudo ln -fs /opt/homebrew/opt/squid/sbin/squid /usr/local/bin/squid
sudo ln -fs /opt/homebrew/Cellar/squid/6.11/libexec/security_file_certgen /usr/local/bin/security_file_certgen
find /opt/homebrew -name "security_file_certgen" 2>/dev/null
# /opt/homebrew/Cellar/squid/6.11/libexec/security_file_certgen
sudo mkdir -p /usr/local/etc/squid/ssl_cert
SELECT rolname FROM pg_roles;
--DROP USER postgres;
CREATE USER postgres WITH PASSWORD 'postgres';
ALTER USER postgres WITH SUPERUSER;
@andrewpetrochenkov
andrewpetrochenkov / homebrew.mxcl.postgresql.plist
Last active September 17, 2024 08:35
postgresql brew #brew #postgresql
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>homebrew.mxcl.postgresql</string>
<key>ProgramArguments</key>
<array>
@andrewpetrochenkov
andrewpetrochenkov / github-api-headers.py
Last active October 18, 2024 08:25
github api headers #github
import os
import requests
headers = {
"Authorization": "Bearer %s" % os.getenv('GITHUB_TOKEN')
}
r = requests.get("https://api.github.com/",headers=headers)
for k,v in r.headers.items():
print('%s: %s' % (k,v))
@andrewpetrochenkov
andrewpetrochenkov / child-pids.sh
Created August 16, 2024 18:29
get child PIDs #pid
child-pids() {
local childs=
childs="$(pgrep -P "$1")"
[[ -n "$childs" ]] && while IFS= read child; do
pids "$child"
done <<< "$childs"
[[ $1 != $$ ]] && echo "$1"
}
child-pids "$1"
Development Status :: 1 - Planning
Development Status :: 2 - Pre-Alpha
Development Status :: 3 - Alpha
Development Status :: 4 - Beta
Development Status :: 5 - Production/Stable
Development Status :: 6 - Mature
Development Status :: 7 - Inactive
Environment :: Console
Environment :: Console :: Curses
Environment :: Console :: Framebuffer