Skip to content

Instantly share code, notes, and snippets.

View mikedamm's full-sized avatar

Mike Damm mikedamm

View GitHub Profile
@mikedamm
mikedamm / fuckyousystemd.sh
Last active August 24, 2024 03:08
Fix systemd-resolved so it does not bind port 53
#!/bin/bash
#
# curl https://gist.githubusercontent.com/mikedamm/82958f9af8640395f3f276af92aaf980/raw/fuckyousystemd.sh | bash
#
echo "Before"
lsof -i -P -n | grep LISTEN | grep ':53'
sed -r -i.orig 's/#?DNSStubListener=yes/DNSStubListener=no/g' /etc/systemd/resolved.conf && \
sh -c 'rm /etc/resolv.conf && ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf' && \
systemctl restart systemd-resolved
echo "After"
@mikedamm
mikedamm / gist:53dc6a78b976eeac88893427424c2527
Last active June 1, 2021 13:01
Docker auto-restart on file change
while inotifywait -e close_write -r . ; do docker-compose build --no-cache ; docker-compose up -d --force-recreate ; done
fallocate -l 8G /swapfile && chmod 600 /swapfile && mkswap /swapfile && swapon /swapfile && echo "/swapfile swap swap defaults 0 0" >> /etc/fstab

Keybase proof

I hereby claim:

  • I am mikedamm on github.
  • I am miked (https://keybase.io/miked) on keybase.
  • I have a public key whose fingerprint is 1D92 CC04 A973 A66C DE66 5B41 E2A2 979E 3B83 209E

To claim this, I am signing this object:

@mikedamm
mikedamm / ltstonorm.sh
Last active October 16, 2017 02:55
Upgrade Ubuntu LTS to Normal
#!/bin/bash
aptitude -y install update-manager-core
sed -i 's/Prompt=LTS/Prompt=normal/g' /etc/update-manager/release-upgrades
do-release-upgrade
@mikedamm
mikedamm / gist:d0ef2291a3c4eecdc35a
Created September 25, 2014 00:20
Remove McAfee Endpoint Security for Mac without uninstall password
rm -f /Library/LaunchAgents/com.mcafee.menulet.plist
rm -f /Library/LaunchAgents/com.mcafee.reporter.plist
rm -f /Library/LaunchDaemons/com.mcafee.ssm.Eupdate.plist
rm -f /Library/LaunchDaemons/com.mcafee.ssm.ScanFactory.plist
rm -f /Library/LaunchDaemons/com.mcafee.virusscan.fmpd.plist
rm -rf /Library/Application\ Support/McAfee
rm -rf /usr/local/McAfee
shutdown -r now
Verifying myself: My Bitcoin username is +miked. https://onename.io/miked
@mikedamm
mikedamm / gist:5406663
Created April 17, 2013 18:40
The worlds most awesome AJAX implementation. Every 2 seconds request the documents URL from the server and replace the entire DOM with the response.
$(document).ready(function() {
setTimeout(function() {
$.ajax({
cache: false
}).done(function(html) {
var newDoc = document.open("text/html", "replace");
newDoc.write(html);
newDoc.close();
});
}, 2000);
@mikedamm
mikedamm / gist:4264678
Created December 12, 2012 03:39
MySQL INT(x) is useless
mysql> show create table testing;
+---------+----------------------------------------------------------------------------------------------+
| Table | Create Table |
+---------+----------------------------------------------------------------------------------------------+
| testing | CREATE TABLE `testing` (
`foobar` int(1) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 |
+---------+----------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
@mikedamm
mikedamm / info.sh
Created January 23, 2012 08:24
A quick tool to help you resolve intermediate certificate chains
#!/bin/bash
echo -ne "File:\t"
echo $1
echo -ne "Hash:\t"
openssl x509 -noout -hash -in $1
echo -ne "Issuer:\t"
openssl x509 -noout -issuer -in $1
echo -ne "Issuer Hash:\t"
openssl x509 -noout -issuer_hash -in $1
echo -ne "Fingerprint:\t"