Skip to content

Instantly share code, notes, and snippets.

@dylan-k
dylan-k / crawler.sh
Last active October 13, 2017 19:00 — forked from nerdpanda/crawler.sh
wget crawler
#!/bin/bash
#
# Crawls a domain
# Retreives all visible URLs and their page titles
# Saves to CSV
# $1 = URL
# $2 = csv filename
#
# USAGE:
# save this script as, say, crawler.sh”.
#!/usr/bin/env python
import json
import sys
# See https://msdn.microsoft.com/en-us/library/aa753582%28VS.85%29.aspx
# and https://github.com/shaarli/Shaarli/blob/v0.6.5/index.php#L1899
HEADER = u'<!DOCTYPE NETSCAPE-Bookmark-file-1><DL>'
FOOTER = u'</DL>'
ITEM = u'<DT><A HREF="{url}" ADD_DATE="{time_created}" TAGS="{tags}">{title}</A>'
import os, sys, re
patterns = [
# <img src='http://s.wordpress.com/latex.php?latex=%5Cmathcal%7BO%7D%28n%29&#038;bg=T&#038;fg=000000&#038;s=0' alt='\mathcal{O}(n)' title='\mathcal{O}(n)' class='latex' />
(r'<img.*?title=\'(.*?)\' class=\'latex\' />',
'$$ \\1 $$ ',
0),
# [<img class=" size-full wp-image-1722 aligncenter" src="http://erikbern.com/wp-content/uploads/2016/01/avg.png" alt="avg" width="512" height="512" />](http://erikbern.com/wp-content/uploads/2016/01/avg.png)
(r'\[(<img.*?)\]\(.*?\)',
<?php
function my_find_expired_events( $ids ) {
$args = array(
'post_type' => 'tribe_events',
'nopaging' => true,
'fields' => 'ids',
'meta_query' => array(
array(
@dericed
dericed / sips-r.sh
Created September 10, 2015 16:45
recursive use of sips to create a directory of thumbnails from a directory of images
#!/bin/bash
if [[ ! "${#}" == 2 ]] ; then
echo "Please provide input and output directories, and no other arguments."
exit 1
fi
input="${1}"
output="${2}"
@royrusso
royrusso / git develop to master
Created April 8, 2015 17:33
Git: merge 'develop' in to 'master'
git checkout master
git merge develop
git push -u origin master
@wpmark
wpmark / gist:9d5d2395cb01a2de0179
Created October 8, 2014 11:06
Check If WordPress Post is Older than X Days
<?php
/*******************************
* this will work in the loop
*******************************/
/* check if the posts publish date is older than 60 days */
if( strtotime( $post->post_date ) < strtotime('-60 days') ) {
/* post is older than 60 days - do something with it!! */
@dylan-k
dylan-k / regex.md
Last active November 16, 2022 16:54
Useful Regular Expressions
@craigeley
craigeley / sifttter.rb
Last active July 23, 2018 16:37
This script looks for text files in a specific folder that include completed tasks ('@done') and timestamps, and then collects them into a daily log for the Day One journaling application. It works especially well when it's connected to IFTTT. See more details at http://craigeley.com/tagged/sifttter
#!/usr/bin/ruby
# SIFTTTER 1.5: An IFTTT-to-Day One Logger by Craig Eley 2014 <http://craigeley.com>
# Based on tp-dailylog.rb by Brett Terpstra 2012 <http://brettterpstra.com>
# Multiple Date Function by Paul Hayes 2014 <http://paulrhayes.com>
#
# Notes:
# * Uses `mdfind` to locate a specific folder of IFTTT-generated text files changed in the last day
# * The location of your folder should be hardcoded in line 67, and the location of your Day One in line 66
# * Scans leading timestamps in each line matching the selected dates
# * Does not alter text files in any way
@erichurst
erichurst / US Zip Codes from 2013 Government Data
Created December 9, 2013 23:00
All US zip codes with their corresponding latitude and longitude coordinates. Comma delimited for your database goodness. Source: http://www.census.gov/geo/maps-data/data/gazetteer.html
This file has been truncated, but you can view the full file.
ZIP,LAT,LNG
00601,18.180555, -66.749961
00602,18.361945, -67.175597
00603,18.455183, -67.119887
00606,18.158345, -66.932911
00610,18.295366, -67.125135
00612,18.402253, -66.711397
00616,18.420412, -66.671979
00617,18.445147, -66.559696
00622,17.991245, -67.153993