Skip to content

Instantly share code, notes, and snippets.

💭
PHP

cwylie0 cwylie0

💭
PHP
Block or report user

Report or block cwylie0

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@brianpursley
brianpursley / scrape.py
Last active Mar 17, 2020
Python script to extract a price from a product web page
View scrape.py
from bs4 import BeautifulSoup
from urllib2 import Request, urlopen
import decimal
def findPrice(url, selector):
userAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36"
req = Request(url, None, {'User-Agent': userAgent})
html = urlopen(req).read()
soup = BeautifulSoup(html, "lxml")
return decimal.Decimal(soup.select(selector)[0].contents[0].strip().strip("$"))
@azhawkes
azhawkes / spider.sh
Created Jan 13, 2014
Really simple wget spider to obtain a list of URLs on a website, by crawling n levels deep from a starting page.
View spider.sh
#!/bin/bash
HOME="http://www.yourdomain.com/some/page"
DOMAINS="yourdomain.com"
DEPTH=2
OUTPUT="./urls.csv"
wget -r --spider --delete-after --force-html -D "$DOMAINS" -l $DEPTH "$HOME" 2>&1 \
| grep '^--' | awk '{ print $3 }' | grep -v '\. \(css\|js\|png\|gif\|jpg\)$' | sort | uniq > $OUTPUT
View tmux_cheatsheet.markdown

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

You can’t perform that action at this time.