Skip to content

Instantly share code, notes, and snippets.

AT&T,number@txt.att.net
Boost Mobile,number@sms.myboostmobile.com
Consumer Cellular
C-Spire,number@cspire1.com
Google Fi,number@msg.fi.google.com
Metro PCS,number@mymetropcs.com
Mint Mobile,number@mailmymobile.net
Page Plus,number@vtext.com
Republic Wireless,number@text.republicwireless.com
Simple Mobile,number@smtext.com
@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

@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

Using tar you can exclude directories by placing a tag file in any directory that should be skipped.

Create tag files,

touch /sys/.exclude_from_backup
touch /proc/.exclude_from_backup

Then,

@ethanpil
ethanpil / index.html
Created April 27, 2020 06:20
Flexbox Dead Center
<html>
<head>
<title>Flexbox Dead Center</title>
<style>
.deadcenter {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
height: 100%;
@ethanpil
ethanpil / gist:e5a82ea5ce92cc4ba860582193a4d570
Created March 22, 2020 23:22
ffmpeg windows batch convert all mp3 to mp4
for /f "tokens=1 delims=." %a in ('dir /B *.mp3') do ffmpeg -i "%a.mp3" -q:a 4 "%a.ogg"
@ethanpil
ethanpil / dl.bat
Last active March 20, 2020 06:26
Windows Batch to Download Consecutive Files with Wget
@ECHO OFF
SetLocal EnableDelayedExpansion
FOR /L %%G IN (1, 1, 465) DO (
SET num=%%G
REM You can escape ampersands with ^ like this: ^&
wget -x --load-cookies cookies.txt --user-agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0" -O !num!.png https://website.com?year=2012^&page=!num!.png
REM Add a delay between each download
TIMEOUT /T 60 /NOBREAK
)
EndLocal
@ethanpil
ethanpil / giphy
Created August 25, 2019 20:01
Bash Command to Download Giphy as GIF
giphy() {
#Thank you Eric - https://eric.blog/2019/01/12/how-to-download-a-gif-from-giphy/
[[ "$1" ]] || { echo "Error: Missing giphy url" >&2; return 1; }
curl -F "file=@$1" "$2"
curl "$1" --output ~/Downloads/giphy.gif
}
@ethanpil
ethanpil / gist:78e950942ef49bd254b40529b4b61f41
Created June 12, 2017 14:39
PHP Process Forks / Parallel Processing
<?php
// Source: https://www.stitcher.io/blog/process-forks
function async(Process $process) : Process {
socket_create_pair(AF_UNIX, SOCK_STREAM, 0, $sockets);
[$parentSocket, $childSocket] = $sockets;
if (($pid = pcntl_fork()) == 0) {
socket_close($childSocket);
socket_write($parentSocket, serialize($process->execute()));
@ethanpil
ethanpil / regex.custom.pm
Created May 16, 2017 20:03
Custom regex rules for CSF/LFD and NginX plus Wordpress fail2ban plugin
#!/usr/bin/perl
###############################################################################
# Copyright 2006-2015, Way to the Web Limited
# URL: http://www.configserver.com
# Email: sales@waytotheweb.com
###############################################################################
sub custom_line {
my $line = shift;
my $lgfile = shift;