Skip to content

Instantly share code, notes, and snippets.

View andrewp-as-is's full-sized avatar
🔍

Andrew P andrewp-as-is

🔍
View GitHub Profile
@andrewp-as-is
andrewp-as-is / send_message.py
Last active November 10, 2022 15:10
celery AWS SQS send message
#!/usr/bin/env python
import base64
from botocore.exceptions import ClientError
import boto3
import json
import logging
import os
def send_sqs_message(sqs_queue_url, body,attrs):
sqs_client = boto3.client('sqs')
@andrewp-as-is
andrewp-as-is / Finder fix.command
Last active September 21, 2022 03:13
macOS Finder fix
#!/usr/bin/env bash
# if Finder not open window on click
rm -f ~/Library/Preferences/com.apple.finder.plist
/usr/bin/killall Finder
/usr/bin/open -a Finder
@andrewp-as-is
andrewp-as-is / sound.sh
Last active July 25, 2022 19:25
macOS startup sound #macos
defaults write .GlobalPreferences com.apple.sound.beep.sound /System/Library/Sounds/Basso.aiff
@andrewp-as-is
andrewp-as-is / register app.sh
Last active January 25, 2022 07:28
macOS lsregister app
#!/usr/bin/env bash
{ set +x; } 2>/dev/null
set ~/Applications/name.app
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -f "$@"
@andrewp-as-is
andrewp-as-is / networksetup.sh
Last active October 14, 2021 10:56
macOS Wi-Fi #macos
/usr/sbin/networksetup -getairportpower en1 # On/Off
/usr/sbin/networksetup -getairportpower en1 | grep -iq "On"
# /usr/sbin/networksetup -setairportpower en0 on
# /usr/sbin/networksetup -setairportpower en0 off
export PATH="/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources":$PATH
airport -s
@andrewp-as-is
andrewp-as-is / postgres-logs.sh
Created June 17, 2020 13:16
PostgreSQL logs #postgresql
sudo find /var/log/postgresql -name '*.log'
sudo find /var/log/postgresql -name '*.log' -exec rm {} \;
@andrewp-as-is
andrewp-as-is / gmail.py
Last active October 13, 2021 19:22
#python #gmail
#!/usr/bin/env python
import imaplib
import email
# Sign in using App Passwords
# https://support.google.com/accounts/answer/185833
# App passwords
# https://myaccount.google.com/security
@andrewp-as-is
andrewp-as-is / pip.sh
Last active October 13, 2021 19:21
python pip #python #pip
curl https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py
python /tmp/get-pip.py
python -c "import pip;print(pip.__version__)"
@andrewp-as-is
andrewp-as-is / ip.sh
Last active October 13, 2021 19:13
AWS EC2 IP #aws
curl http://169.254.169.254/latest/meta-data/local-ipv4
@andrewp-as-is
andrewp-as-is / set_password.py
Last active October 13, 2021 19:12
Django set_password #django
from django.contrib.auth.models import User
try:
user = User.objects.get(username="username")
user.set_password('password')
user.save()
except DoesNotExist:
pass