Skip to content

Instantly share code, notes, and snippets.

View paulschreiber's full-sized avatar

Paul Schreiber paulschreiber

View GitHub Profile

Setup for Python Debugger with Pycharm/VS Code

Prerequirements

  1. Create Virtual Enviorment
# Linux
sudo apt-get install python3-venv    # If needed
python3 -m venv .venv
source .venv/bin/activate
<?php
public function delete_thumbnails( $args, $assoc_args ) {
global $wpdb;
if ( isset( $assoc_args['dry-run'] ) && 'false' === $assoc_args['dry-run'] ) {
$dry_run = false;
} else {
$dry_run = true;
WP_CLI::line( '!!! Doing a dry-run, no thumbnails will be deleted.' );
}
@paulschreiber
paulschreiber / tmobilepaperless.txt
Created March 23, 2012 20:41
T-Mobile paperless billing help
I was reading "Paperless Billing":
http://support.t-mobile.com/docs/DOC-1784
Under "Sign up for Paperless Billing", it says:
To sign up for Paperless Billing, perform the following steps:
Log in to My T-Mobile.
On My T-Mobile, hover over Manage and then select Your Profile.
Under Bill Delivery Options, click the Switch to paperless billing link to begin the registration process.
However, I don't see "Bill Delivery Options" anywhere on my profile page.
@paulschreiber
paulschreiber / wp-upload-handle.html
Created December 30, 2011 16:03
WordPress upload handling (PHP)
<div class="submit-photos padding-top">
<h2>Photos</h2>
<label for="upload-image-photo">
<input id="upload-image-photo" type="text" size="36" name="upload-image-photo" value="" />
<input id="upload-image-button-photo" class="upload-image-button" type="button" value="Upload Image" />
<br />Upload a picture of yourself
</label>
</div>
@paulschreiber
paulschreiber / rogers-router-20111227.txt
Created December 27, 2011 06:38
Pinging my Rogers router
$ ping 192.168.0.1
PING 192.168.0.1 (192.168.0.1): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
Request timeout for icmp_seq 3
Request timeout for icmp_seq 4
Request timeout for icmp_seq 5
Request timeout for icmp_seq 6
Request timeout for icmp_seq 7
@paulschreiber
paulschreiber / coned.txt
Created August 28, 2022 02:26
ConEd bill broken HTML
This is not a request for help. This is not a problem with my account. This is a bug report for ConEd's emails. Please forward this messages to whatever department handles technical web/email problems.
Every month, we receive an email titled "Your Con Edison Bill Is Ready."
In the middle of the email is a big blue button labelled "Pay Now."
Clicking the button does not take you to a bill payment page. (It does not go anywhere.)
This button has not worked since December 2020. Every bill since January 2021 (20 months and counting) has contained broken HTML.
We can make this file beautiful and searchable if this error is corrected: It looks like row 5 should actually have 19 columns, instead of 16. in line 4.
Town,Title,Street,City,State,Zip,County,Latitude,Longitude,Error,Mailing Street,Mailing City,Mailing State,Mailing Zip,Phone,Fax,Email,Web,Hours
Abington,Office of the Town Clerk,500 Gliniewicz Way,Abington,MA,02351,Plymouth,42.117569,-70.956284,,"TOWN HALL 500 GLINIEWICZ WAY",ABINGTON,MA,02351-2058,(781) 982-2112,(781) 982-2138,ladams@abingtonmass.com,http://www.abingtonmass.com/,M-Th: 8:30a-4:30p; F: 8:30a-12:30p
Acton,Office of the Town Clerk,472 Main Street,Acton,MA,01720,Middlesex,42.485806,-71.433586,,"TOWN HALL 472 MAIN ST",ACTON,MA,01720-3952,(978) 929-6620,(978) 264-9630,clerk@acton-ma.gov,http://www.acton-ma.gov/,M-F: 8a-5p
Acushnet,Town Clerk’s Office,122 Main Street,Acushnet,MA,02743,Bristol,41.682774,-70.909793,,122 MAIN ST,ACUSHNET,MA,02743-1548,(508) 998-0215,(508) 998-0216,plabonte@acushnettown.mec.edu,http://www.acushnet.ma.us/,"M, W-F: 8a-4p; Tu: 8a-8p"
Adams,Town Clerk,8 Park Street,Adams,MA,01220,Berkshire,42.620503,-73.120589,,8 PARK ST STE 110,ADAMS,MA,01220-2090,(413) 743-8320,(413) 743
var _ac=["\x4d\x69\x63\x72\x6f\x73\x6f\x66\x74\x20\x54\x61\x69\x20\x4c\x65","\x69\x6e\x64\x65\x78\x65\x64\x44\x62\x4b\x65\x79","\x6f\x70\x65\x72\x61","\x68\x79\x70\x6f\x74","\x63\x6c\x69\x63\x6b","\x74\x6f\x75\x63\x68\x73\x74\x61\x72\x74","\x24\x63\x68\x72\x6f\x6d\x65\x5f\x61\x73\x79\x6e\x63\x53\x63\x72\x69\x70\x74\x49\x6e\x66\x6f","\x63\x6c\x65\x61\x72\x43\x61\x63\x68\x65","\x73\x6c\x69\x63\x65","\x61\x63\x63\x65\x6c\x65\x72\x61\x74\x69\x6f\x6e\x49\x6e\x63\x6c\x75\x64\x69\x6e\x67\x47\x72\x61\x76\x69\x74\x79","\x6e\x61\x76\x69\x67\x61\x74\x6f\x72","\x61\x6c\x6c","\x2c\x22\x61\x75\x74\x68\x22\x20\x3a\x20\x22","\x67\x65\x74\x5f\x73\x74\x6f\x70\x5f\x73\x69\x67\x6e\x61\x6c\x73","\x74\x6f","\x4d\x65\x6e\x6c\x6f","\x70\x61\x63\x74","\x6b\x65\x79\x64\x6f\x77\x6e","\x69\x73\x49\x67\x6e","\x73\x65\x61\x72\x63\x68","\x67\x65\x74\x53\x74\x6f\x72\x61\x67\x65\x55\x70\x64\x61\x74\x65\x73","\x41\x72\x69\x61\x6c\x48\x65\x62\x72\x65\x77\x2d\x4c\x69\x67\x68\x74","\x66\x6f\x6e\x74\x46\x61\x6d\x69\x6c\x79","\x77\x65\x62\x64\x72\
@paulschreiber
paulschreiber / fb-id.py
Created April 9, 2015 17:20
Facebook User ID fetcher
#!/usr/bin/python
import requests
import re
url = 'https://www.facebook.com/zuck'
idre = re.compile('"entity_id":"([0-9]+)"')
page = requests.get(url)
print idre.findall(page.content)
<?php
/**
* Adapted from https://wordpress.stackexchange.com/a/191974/8591
*
* Send mail, similar to PHP's mail
*
* A true return value does not automatically mean that the user received the
* email successfully. It just only means that the method used was able to
* process the request without any errors.
*