Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Stop all running containers
echo "Stopping all running containers..."
docker stop $(docker ps -q)
# Remove all containers
echo "Removing all containers..."
docker rm $(docker ps -a -q)
@ygorth
ygorth / list.txt
Created May 17, 2023 23:04 — forked from shortjared/list.txt
List of AWS Service Principals
a4b.amazonaws.com
access-analyzer.amazonaws.com
account.amazonaws.com
acm-pca.amazonaws.com
acm.amazonaws.com
airflow-env.amazonaws.com
airflow.amazonaws.com
alexa-appkit.amazon.com
alexa-connectedhome.amazon.com
amazonmq.amazonaws.com
@ygorth
ygorth / googlebot-load-testing-script
Last active February 10, 2021 03:18
googlebot-load-testing-script
# How to use:
# curl -L https://gist.githubusercontent.com/ygorth/7afc92d89badcf81ef47fe8e681c5e9f/raw/4d542337675dc23cf357c6d15458da054af480df/googlebot-load-testing-script | bash -s 20 "http://server.com/api"
# This keeps hitting your server at the rate of 20 calls/second until you ask it to stop
max="$1"
date
echo "url: $2
rate: $max calls / second"
START=$(date +%s);
get () {
@ygorth
ygorth / aws-cfn-bootstrap-centos7.sh
Last active August 22, 2018 16:13 — forked from JetFault/aws-cfn-bootstrap-centos7.sh
aws-cfn-bootstrap for CentOS 7
yum install -y epel-release
yum install -y python-pip
cd /usr/bin
pip install pystache
pip install argparse
pip install python-daemon
pip install requests
cd /opt
@ygorth
ygorth / login-background.sh
Created May 23, 2018 02:10 — forked from jjvillavicencio/login-background.sh
Genome Login Background
WORKDIR=~/tmp/gdm-login-background
GST=/usr/share/gnome-shell/gnome-shell-theme.gresource
GSTRES=$(basename $GST)
mkdir -p $WORKDIR
cd $WORKDIR
mkdir theme
for r in `gresource list $GST`; do
gresource extract $GST $r >$WORKDIR$(echo $r | sed -e 's/^\/org\/gnome\/shell\//\//g')
Error messages:
$ tailf /var/log/jenkins/jenkins.log
WARNING: Prober(fe80:0:0:0:c2b:e0ff:feff:d000%eth1.local.).run() exception
java.io.IOException: Operation not permitted (sendto failed)
at java.net.PlainDatagramSocketImpl.send(Native Method)
at java.net.DatagramSocket.send(DatagramSocket.java:693)
at javax.jmdns.impl.JmDNSImpl.send(JmDNSImpl.java:1537)
at javax.jmdns.impl.tasks.state.DNSStateTask.run(DNSStateTask.java:131)
at java.util.TimerThread.mainLoop(Timer.java:555)
@ygorth
ygorth / troubleshooting-centos-7-postfix-amazon-ses.txt
Last active December 6, 2017 06:21
troubleshooting-centos-7-postfix-amazon-ses
# Error message
$ tail -f /var/log/maillog
Dec 6 06:06:16 prdmgtjmp01 postfix/smtp[17822]: 0B11CC41153: to=<[email protected]>, relay=email-smtp.us-west2.amazonaws.com[35.162.44.160]:587, delay=4.2, delays=0.03/0.04/4.2/0, dsn=4.7.0, status=deferred (SASL authentication failed; cannot authenticate to server email-smtp.us-west-2.amazonaws.com[35.162.44.160]: no mechanism available)
Dec 6 06:11:04 prdmgtjmp01 postfix/qmgr[17814]: 9CA16C43607: from=<root@>, size=466, nrcpt=1 (queue active)
Dec 6 06:11:05 prdmgtjmp01 postfix/smtp[17830]: 78F56C41157: SASL authentication failed; cannot authenticate to server email-smtp.us-west-2.amazonaws.com[52.10.113.69]: no mechanism available
Dec 6 06:11:05 prdmgtjmp01 postfix/smtp[17829]: warning: SASL authentication failure: No worthy mechs found
# Solution:
$ yum install cyrus-sasl{,-plain}
# Try again:
@ygorth
ygorth / restore-git-submodules.sh
Created November 28, 2017 20:32 — forked from aroemen/restore-git-submodules.sh
Restore git submodules from .gitmodules. Since git submodule init only considers submodules that already are in the index (i.e. "staged") for initialization this short script parses .gitmodules, and each url and path pair.
#!/bin/sh
set -e
git config -f .gitmodules --get-regexp '^submodule\..*\.path$' |
while read path_key path
do
url_key=$(echo $path_key | sed 's/\.path/.url/')
url=$(git config -f .gitmodules --get "$url_key")
git submodule add $url $path
@ygorth
ygorth / netping.sh
Last active November 9, 2017 05:03
Simple network tools
#!/bin/bash
if [ "$1" == "" ]
then
echo "Usage: ./ping .sh 192.168.1"
else
for x in `seq 1 254`; do
ping -c 1 $1.$x | grep "64 bytes" | cut -d " " -f 4 | sed 's/.$//'
done
fi
@ygorth
ygorth / git-clearHistory
Last active July 13, 2018 20:55 — forked from stephenhardy/git-clearHistory
Steps to clear out the history of a git/github repository
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init && git add . && git status
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin [email protected]:<YOUR ACCOUNT>/<YOUR REPOS>.git
git push -u --force origin master