Skip to content

Instantly share code, notes, and snippets.

@ethanpil
ethanpil / gist:94195cc149f9e00504972dbb18994ac8
Last active February 21, 2022 21:43
Use WP CLI to migrate a WordPress database with search-replace
#On the source WP site:
wp db export wp-export.sql --all-tables
#On the destination site
#First import the new DB
wp db import wp-export.sql
## Replace basic URLs
wp search-replace oldsite.com newsite.com --skip-columns=guid --all-tables
@ethanpil
ethanpil / xamples.md
Last active April 14, 2022 18:54
Create Windows Firewall Rules via CMD

General Syntax

netsh advfirewall firewall add rule name="RULENAME" dir=[in/out] action=[allow/block/bypass] protocol=[tcp/udp] localip=[any] remoteip=[any]

Block a program (executable)

netsh advfirewall firewall add rule name="Block My EXE" dir=out program="c:\Program Files\Folder\blockme.exe" profile=any action=block

Open a port

netsh advfirewall firewall add rule name="allowPort80" dir=in action=allow protocol=TCP localport=80

AT&T,[email protected]
Boost Mobile,[email protected]
Consumer Cellular
C-Spire,[email protected]
Google Fi,[email protected]
Metro PCS,[email protected]
Mint Mobile,[email protected]
Page Plus,[email protected]
Republic Wireless,[email protected]
Simple Mobile,[email protected]
@ethanpil
ethanpil / pac_aliases
Created June 24, 2022 20:18 — forked from rroblak/pac_aliases
Package manager-independent bash aliases
# paci - install one or more packages
# pacu - upgrade all packages to their newest version
# pacr - uninstall one or more packages
# pacs - search for a package using one or more keywords
# pacinfo - show information about a package
# pacinstalled - show if a package is installed
# paca - list all installed packages
# paclo - list all packages which are orphaned
# pacdnc - delete all not currently installed package files
# pacfiles - list all files installed by a given package
#Setup Squeezebox / Logitech Music ona fresh alpine install
apk add --no-cache curl
curl -Ls http://www.sodface.com/repo/sodface-pub-key.tar.gz | tar -C /etc/apk/keys/ -xvz [email protected]
echo http://www.sodface.com/repo >> /etc/apk/repositories
apk add --no-cache espeak faad2 flac ffmpeg lame lms perl-crypt-cbc sox wavpack
apk del curl
mkdir /home/lms
mkdir /home/lms/cache
@ethanpil
ethanpil / alpine-dropbear-ssh.sh
Last active November 4, 2022 18:41
Install Drop Bear SSH Deamon on Alpine Linux
#Install Dropbear
apk add dropbear
#Start the service
rc-service dropbear start
#Add it to the default runlevel
rc-update add dropbear
#Settings in /etc/conf.d/dropbear
@ethanpil
ethanpil / alpine-php7-mssql-pdo.sh
Last active November 4, 2022 03:54
alpine-php7-mssql-pdo
apk update
apk add --no-cache curl php7 php7-pdo php7-fpm unixodbc ca-certificates && update-ca-certificates pecl
cd /tmp
curl -O https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/msodbcsql17_17.5.2.2-1_amd64.apk
curl -O https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/mssql-tools_17.5.2.1-1_amd64.apk
apk add --allow-untrusted msodbcsql17_17.5.2.2-1_amd64.apk
apk add --allow-untrusted mssql-tools_17.5.2.1-1_amd64.apk
url -L https://github.com/microsoft/msphpsql/releases/download/v5.10.1/Alpine315-7.4.tar | tar xv
cp /tmp/Alpine315-7.4/php_pdo_sqlsrv_74_nts.so /usr/lib/php7/modules/php_pdo_sqlsrv.so
#https://codingwithmanny.medium.com/configure-self-signed-ssl-for-nginx-docker-from-a-scratch-7c2bcd5478c6
apk add nginx
mkdir /etc/ssl/private
openssl req -x509 -nodes -days 365 -subj "/C=CA/ST=QC/O=Company, Inc./CN=mydomain.com" -addext "subjectAltName=DNS:mydomain.com" -newkey rsa:2048 -keyout /etc/ssl/private/nginx-selfsigned.key -out /etc/ssl/certs/nginx-selfsigned.crt;
mkdir /srv/www
chown -R nginx:nginx /srv/www
#Configuring nginx
#install wkhmltopdf on alpine linux 3.15
apk add --update --no-cache --wait 10 libstdc++ libx11 libxrender libxext libssl1.1 ca-certificates fontconfig freetype ttf-dejavu ttf-droid ttf-freefont ttf-liberation && \
apk add --update --no-cache --virtual .build-deps msttcorefonts-installer
update-ms-fonts && fc-cache -f
rm -rf /tmp/* && apk del .build-deps
cd /usr/bin
curl -LJO https://github.com/khalilgharbaoui/wkhtmltopdf-binary-edge-alpine/raw/master/libexec/wkhtmltopdf-alpine-linux-amd64
mv wkhtmltopdf-alpine-linux-amd64 wkhtmltopdf
$gnuplotcommands = '
set terminal png size 640x480
set grid
set autoscale
unset log
unset label
set xtics 0,1,23
set ytic auto
set title "Sample Chart Data"
set xlabel "Date"