This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from BeautifulSoup import BeautifulSoup | |
soup = BeautifulSoup(requests.get("http://beeradvocate.com/search?q=ipa&qt=beer").content) | |
# Find the beer links | |
results = soup.findAll('div') | |
# How many beers did it find | |
beer_count = results[12].find('b').string.split(' ')[1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# change this to the path where you have the images stored | |
src_path='/Users/tzayad/Pictures/test'; cd $src_path | |
# change this to the length you want for the smallest side | |
t_size=250; | |
# for each image of the type jpeg/jpg/gif/png loop through and resize | |
for img in `find . -iname \*.jpeg -o -iname \*.jpg -o -iname \*.png -o -iname \*.gif`; do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with timeout of (30 * 60) seconds | |
tell application "Finder" | |
set input_images to every document file of folder "Users:tzayad:Pictures:test" of startup disk whose name extension is "jpg" or name extension is "png" | |
end tell | |
tell application "Image Events" | |
launch | |
repeat with a from 1 to length of input_images | |
try |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php require('simple_html_dom.php'); | |
function generate_newsletter_archives($atts, $content = null) { | |
// setup the beginning of our data table for archives | |
$out = '<table cellpadding="0" cellspacing="0" id="newsletter-archives"><tr><th>Resource</th><th>Date</th></tr><tbody>'; | |
// fetch the page which contains all of the newsletter issues that have been archived | |
$archive_page = str_get_html(wp_remote_retrieve_body(wp_remote_get('http://archive.constantcontact.com/fs127/1103640951068/archive/1111407854121.html'))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import binascii | |
import re | |
# highlights are stored in *.mbp files corresponding to the filename of the book | |
# in ~/Library/Application Support/Kindle/My Kindle Content/ | |
# EA 44 41 54 41 - beginning of highlight | |
# 44 41 54 41 - end of highlight (except last highlight which *sometimes* ends with 42 4B 4D 4B) | |
fh = '0131177052.WrkngEffLegCode.mbp' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bytes" | |
"encoding/binary" | |
"fmt" | |
"net" | |
) | |
func main() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
install | |
repo --name=base --baseurl=http://mirror.cogentco.com/pub/linux/centos/7/os/x86_64/ | |
url --url="http://mirror.cogentco.com/pub/linux/centos/7/os/x86_64/" | |
lang en_US.UTF-8 | |
keyboard us | |
timezone America/Phoenix | |
cdrom |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// fetches a file and returns an XML document | |
$xml = simplexml_load_file("http://search.cdsonline.com.au/offsite/xmlStock.asp?dlr=wesmotperf"); | |
// loads the XML into the DOM | |
$dom1 = new DomDocument(); | |
$dom1->loadXML($xml->asXML()); | |
// Sets up an object so we can use xpath to query for nodes of the XML document |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import re | |
import jinja2 | |
import shutil | |
import os | |
from bs4 import BeautifulSoup | |
BASE_URL = "http://www.accessdata.fda.gov/cms_ia/" | |
OUTPUT_DIR = "build" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function change_graphic_lib($array) { | |
return array('WP_Image_Editor_GD', 'WP_Image_Editor_Imagick'); | |
} | |
add_filter('wp_image_editors', 'change_graphic_lib'); |
OlderNewer