Skip to content

Instantly share code, notes, and snippets.

@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 / create-large-file.sh
Created February 14, 2019 00:08 — forked from olivertappin/create-large-file.sh
Create a large file for testing
# Please note, the commands below will create unreadable files and should be
# used for testing file size only. If you're looking for something that has
# lines in it, use /dev/urandom instead of /dev/zero. You'll then be able to
# read the number of lines in that file using `wc -l large-file.1mb.txt`
# Create a 1MB file
dd if=/dev/zero of=large-file-1mb.txt count=1024 bs=1024
# Create a 10MB file
dd if=/dev/zero of=large-file-10mb.txt count=1024 bs=10240
@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 / exportShortGitCommit.groovy
Created May 23, 2018 02:11 — forked from fabito/exportShortGitCommit.groovy
Exporting short git commit sha1 hash in Jenkins through System Groovy Script build step
import hudson.model.*
def env = build.getEnvironment()
def gitCommit = env['GIT_COMMIT']
def shortGitCommit = gitCommit[0..6]
def pa = new ParametersAction([
new StringParameterValue("SHORT_GIT_COMMIT", shortGitCommit)
])
@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=<x@gmail.com>, 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