Skip to content

Instantly share code, notes, and snippets.

Avatar

David Wakelin MacroMan

View GitHub Profile
@MacroMan
MacroMan / gist:5077db50d46447e0eae6d50ccc22f4bb
Last active Jul 23, 2020
100% non-interactive `apt-get dist-upgrade`
View gist:5077db50d46447e0eae6d50ccc22f4bb
sudo apt-get update -y && sudo DEBIAN_FRONTEND=noninteractive APT_LISTCHANGES_FRONTEND=none \
apt-get \
-o Dpkg::Options::=--force-confold \
-o Dpkg::Options::=--force-confdef \
-y --allow-downgrades \
dist-upgrade --fix-missing && \
sudo DEBIAN_FRONTEND=noninteractive APT_LISTCHANGES_FRONTEND=none \
apt-get \
-o Dpkg::Options::=--force-confold \
-o Dpkg::Options::=--force-confdef \
View install-mysql-5.7-on-ubuntu-20.04.sh
#!/bin/bash
# Remove existing MySQL installs
sudo apt-get purge mysql-server mysql-client mysql-common mysql-server-core-* mysql-client-core-*
sudo rm -rf /etc/mysql /var/lib/mysql
sudo apt-get autoremove
sudo apt-get autoclean
# Download
wget https://downloads.mysql.com/archives/get/p/23/file/mysql-server_5.7.29-1ubuntu18.04_amd64.deb-bundle.tar
@MacroMan
MacroMan / adminer_upgrade.sh
Created Sep 3, 2019
Adminer upgrade script
View adminer_upgrade.sh
#!/bin/bash
# Get the latest version number
ADMINER_VERSION=$(curl -s https://api.github.com/repos/vrana/adminer/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")' | cut -d 'v' -f 2)
# Download the latest release
wget https://github.com/vrana/adminer/releases/download/v${ADMINER_VERSION}/adminer-${ADMINER_VERSION}.php -O index.php
View gist:57d43f26b3dc7fa2372eb352d4618a2d
javascript:!function(e,t){function n(e,t,n){e.addEventListener(t,n)}function o(e){27==e.which&&(i.removeChild(r),i.removeEventListener("keydown",o))}var i=t.body,d=t.documentElement,r=t.createElement("canvas"),a=r.width=Math.max(e.innerWidth,d.clientWidth,i.clientWidth),h=r.height=Math.max(e.innerHeight,d.clientHeight,i.clientHeight),c=r.style;c.position="absolute",c.left=c.top=0,c.width=a+"px",c.height=h+"px",c.zIndex=1e4,c.cursor="crosshair",i.appendChild(r);var l=r.getContext("2d");l.strokeStyle="undefined"!=typeof BDColor?"#"+BDColor:"#000",l.lineWidth=3;var u=!1,s={x:0,y:0};n(r,"mousedown",function(e){s.x=e.pageX,s.y=e.pageY,u=!0}),n(r,"mouseup",function(){u=!1}),n(r,"mousemove",function(e){if(u){var t=e.pageX,n=e.pageY;l.strokeStyle="undefined"!=typeof BDColor?"#"+BDColor:"#000",l.clearRect(0,0,a,h),l.beginPath(),l.rect(s.x,s.y,t-s.x,n-s.y),l.stroke()}}),n(i,"keydown",o)}(window,document);void(0);
View gist:559a0433515324965c7c82775416cb9c
javascript:!function(e,t){function n(e,t,n){e.addEventListener(t,n)}function o(e){27==e.which&&(i.removeChild(r),i.removeEventListener("keydown",o))}var i=t.body,d=t.documentElement,r=t.createElement("canvas"),h=r.width=Math.max(e.innerWidth,d.clientWidth,i.clientWidth),a=r.height=Math.max(e.innerHeight,d.clientHeight,i.clientHeight),l=r.style;l.position="absolute",l.left=l.top=0,l.width=h+"px",l.height=a+"px",l.zIndex=1e4,l.cursor="crosshair",i.appendChild(r);var c=r.getContext("2d");c.strokeStyle="undefined"!=typeof BDColor?"#"+BDColor:"#000",c.lineWidth=3;var u=!1,s={x:0,y:0};n(r,"mousedown",function(e){s.x=e.pageX,s.y=e.pageY,u=!0}),n(r,"mouseup",function(){u=!1}),n(r,"mousemove",function(e){if(u){var t=e.pageX,n=e.pageY;c.strokeStyle="undefined"!=typeof BDColor?"#"+BDColor:"#000",c.beginPath(),c.moveTo(s.x,s.y),c.lineTo(t,n),c.stroke(),s.x=t,s.y=n}}),n(i,"keydown",o)}(window,document);void(0);
View gist:e14eba837360f8d9b60d7167aeb12310
javascript:var BDColor="000";!function(e,n){function o(e){BDColor=e.target.className,i()}function t(e){27==e.which&&i()}function i(){r.removeChild(a),r.removeEventListener("keydown",t)}function d(e,n,o){e.addEventListener(n,o)}var r=n.body,l=["000","009","090","099","900","909","990","CCC","999","00F","0F0","0FF","F00","F0F","FF0","FFF"],a=n.createElement("div"),c=a.style;c.position="fixed",c.left="100px",c.top="100px",c.zIndex="10000";for(var F=0;F<l.length;F++)a.appendChild(function(e){var t=n.createElement("div");t.className=e;var i=t.style;return i.display="inline-block",i.backgroundColor="#"+e,i.width="25px",i.height="25px",d(t,"click",o),t}(l[F]));n.body.appendChild(a),d(r,"keydown",t)}(window,document);void(0);
View Asterisk 14 install with WSS support
#!/bin/bash
read -p $"This will install Asterisk. [Enter] to continue..."
# get deps
apt -y install build-essential libncurses5-dev libxml2-dev libsqlite3-dev libssl-dev libsrtp0-dev uuid-dev libjansson-dev
read -p $"Installed dependencies. [Enter] to continue..."
# download and install
cd /usr/src
View aliases
alias la='ls -lhaA --color=auto'
alias gg='git gui'
alias gs='git status'
alias ga='git add'
alias gpull='git pull origin master'
alias gpush='git push origin master'
alias gc='git commit -m'
alias sshtunnel="ssh user@server-ip -L 8000:127.0.0.1:3306 -N"
You can’t perform that action at this time.