Skip to content

Commit

Permalink
A place for everything and everything in its place.
Browse files Browse the repository at this point in the history
  • Loading branch information
nickwynja committed Dec 5, 2012
1 parent 1c31147 commit 377e247
Show file tree
Hide file tree
Showing 19 changed files with 251 additions and 323 deletions.
38 changes: 38 additions & 0 deletions README.md
@@ -0,0 +1,38 @@
Here is an assortment of scripts that I've made and/or are in the process of making. You can use them if you think they'll be helpful. Below are some notes about about them:

## Markdown to PDF Converter ##

**Work in progress.**

When complete, this will hopefully work along with Hazel and Dropbox to turn a `.md` file into a PDF with the specified styling. The basis of it turns markdown into HTML and `wkpdf` to go from HTML to PDF. In theory it shouldn't be that hard to do, I just haven't hard a need for it yet so haven't put in the time.

## Meetup Photo Downloader ##

This script will download all images at full resolution from a Meetup.com photo gallery.

Grab to photo album ID from your meetup.com page and run the command like this:

php ~/path/to/meetup-photo-download.php 1234567 /Directory/To/Save/ filename_prefix.

## Random ##

### Garageband to iPad ###

A python script that powers [this service](http://cl.ly/3w1R1h2o1C1v) that converts a Mac `.band` file for use in Garageband for iPad. Pretty handy, though my main use of Garageband at this point is podcasting and Garageband for iPad doesn't do a great job of supporting long projects.

### Get Text ###

A script [I used with Launch Center Pro][text-lcp] as a workaround for appending text to files in Dropbox until there was a better app on the scene. I now [use Notesy][notesy] instead and am just keeping this for reference.

[text-lcp]: http://hackmake.org/2012/06/27/quick-text-and-fast-learning-with-launch-center-pro
[notesy]: http://hackmake.org/2012/10/12/notesy-and-launch-center-pro

### Pythonista Slugger ###

A python script build for use in [Pythonista](http://omz-software.com/pythonista/) that converts a string into a url-ready slug. I use it when copying a title from a draft, convert it, and then have it take my back to Byword.

## Rename Notes ##

**Work in progress.**

A combination of scripts and Hazel rules that checks my Dropbox notes folder for note titles that don't match my tagging convention and list them out in a new note. Editing the text in that note with rename the corresponding note making it easy to review any new notes that were dumped in using nvALT and need to be cleaned up for posterity's sake.
95 changes: 0 additions & 95 deletions gauges.py

This file was deleted.

5 changes: 5 additions & 0 deletions markdown-to-pdf/README.md
@@ -0,0 +1,5 @@
## Markdown to PDF Converter ##

**Work in progress.**

When complete, this will hopefully work along with Hazel and Dropbox to turn a `.md` file into a PDF with the specified styling. The basis of it turns markdown into HTML and `wkpdf` to go from HTML to PDF. In theory it shouldn't be that hard to do, I just haven't hard a need for it yet so haven't put in the time.
File renamed without changes.
13 changes: 13 additions & 0 deletions markdown-to-pdf/mdwkpdf.sh
@@ -0,0 +1,13 @@
#!/bin/bash

I=$1
PATH='/Users/nickwynja/Dropbox/\[Drop\]/\[Convert\]/'
#PATH = '/Users/brain/Dropbox/\[Drop\]/\[Convert\]/'
#FILENAME=$(basename "$I")
#NAME="${filename%.*}"
NAME='this'
echo $1

/bin/markdown2 $I > /tmp/$NAME.html
/usr/bin/wkpdf --source /tmp/$NAME.html --output $PATH $NAME .pdf
/usr/bin/rm /tmp/$NAME.html
7 changes: 7 additions & 0 deletions meetup-photo-downloader/README.md
@@ -0,0 +1,7 @@
## Meetup Photo Downloader ##

This script will download all images at full resolution from a Meetup.com photo gallery.

Grab to photo album ID from your meetup.com page and run the command like this:

php ~/path/to/meetup-photo-download.php 1234567 /Directory/To/Save/ filename_prefix.
25 changes: 20 additions & 5 deletions meetup-photo-download.php → ...hoto-downloader/meetup-photo-download.php 100644 → 100755
@@ -1,13 +1,27 @@
<?php

// Filename for the outputted images. They will be appended with a sequential number.
$filename = "Meetup_Photo";
/*
This script will download all images at full resolution from a Meetup.com photo gallery. To use, save the script to your computer and remember where you put it. For this example, the script will be in your Pictures folder. You can put it wherever you like.
Open Terminal in /Applications/Utilities and put in the command like this to execute the script. Type in:
php ~/Pictures/meetup-photo-download.php 1234567 /Directory/To/Save/ filename_prefix.
*/

// The ID for the photo album. Something like meetup.com/GroupName/photos/12345678
$album_id = "12345678";
$album_id = ($_SERVER['argv'][1]);

// Path to save files
$path = ($_SERVER['argv'][2]);

// Filename for the outputted images. They will be appended with a sequential number.
$filename = ($_SERVER['argv'][3]);


// Get your API Key at http://www.meetup.com/meetup_api/key/
$key = "YOURKEYHERE";
$key = "63e4346865432e323c354a214e7a4c";

$page = 200;
$url = "https://api.meetup.com/2/photos.xml?key=" . $key . "&page=" . $page . "&photo_album_id=" . $album_id;
Expand Down Expand Up @@ -39,10 +53,11 @@ function get_data($url) {
echo "Downloading " . $item->highres_link . "\n";
foreach($item->highres_link as $photo){
file_put_contents($path . $filename . "_" . $i . ".jpg", get_data($photo));
echo "Saved image as " . $path . $filename . "_" . $i . ".jpg" . "\n";
$i = $i + 1;

}
}
}

?>
?>
Binary file added not-done/siri-notes.scpt
Binary file not shown.
60 changes: 60 additions & 0 deletions not-done/track-rss.sh
@@ -0,0 +1,60 @@
#!/bin/bash

# Schedule this to run once a day with cron. Doesn't matter what time since it parses yesterday's hits (by default).
# I only tested this on the Marco.org server, which runs CentOS (RHEL). No idea how it'll work on other distributions, but it's pretty basic.

# Required variables:

if [ "$1" == "hackmake.org" ]; then
LOG_FILE="/var/log/httpd/hackmake-access_log"
REPORT_NAME="hackmake-daily-report"
fi

if [ "$1" == "nickwynja.com" ]; then
LOG_FILE="/var/log/httpd/nickwynja-access_log"
REPORT_NAME="nickwynja-daily-report"
fi

RSS_URI="/rss"
REPORT_PATH="/home/blog/Dropbox/Notes/"

# --- Optional customization ---

# Date expression for yesterday
DATE="-1 day"

# Locale for printf number formatting (e.g. "10000" => "10,000")
LANG=en_US

# Date format in Apache log
LOG_FDATE=`date -d "$DATE" '+%d/%b/%Y'`

# Date format for report
REPORT_FDATE=`date -d "$DATE" '+%Y-%m-%d'`

REPORT_FILE=$REPORT_PATH$REPORT_NAME"-"$REPORT_FDATE".md"

# --- The actual log parsing ---

LOG_FDATE=`date -d "$DATE" "+${LOG_DATE_FORMAT}"`
DAY_BEFORE_FDATE=`date -d "$DATE -1 day" "+${LOG_DATE_FORMAT}"`

# Unique IPs requesting RSS, except those reporting "subscribers":
IPSUBS=`fgrep "$LOG_FDATE" "$LOG_FILE" | fgrep " $RSS_URI" | egrep -v '[0-9]+ subscribers' | cut -d' ' -f 1 | sort | uniq | wc -l`

# Google Reader subscribers and other user-agents reporting "subscribers" and using the "feed-id" parameter for uniqueness:
GRSUBS=`egrep "($LOG_FDATE|$DAY_BEFORE_FDATE)" "$LOG_FILE" | fgrep " $RSS_URI" | egrep -o '[0-9]+ subscribers; feed-id=[0-9]+' | sort -t= -k2 -s | tac | uniq -f2 | awk '{s+=$1} END {print s}'`

# Other user-agents reporting "subscribers", for which we'll use the entire user-agent string for uniqueness:
OTHERSUBS=`fgrep "$LOG_FDATE" "$LOG_FILE" | fgrep " $RSS_URI" | fgrep -v 'subscribers; feed-id=' | egrep '[0-9]+ subscribers' | egrep -o '"[^"]+"$' | sort -t\( -k2 -sr | awk '!x[$1]++' | egrep -o '[0-9]+ subscribers' | awk '{s+=$1} END {print s}'`

REPORT=$(
printf "\n## Feed Stats\n\n"
printf "%'8d Google Reader subscribers\n" $GRSUBS
printf "%'8d subscribers from other aggregators\n" $OTHERSUBS
printf "%'8d direct subscribers\n" $IPSUBS
echo "--------"
printf "%'8d total subscribers\n" `expr $GRSUBS + $OTHERSUBS + $IPSUBS`
)

echo "$REPORT" >> $REPORT_FILE
113 changes: 0 additions & 113 deletions pin_draft.php

This file was deleted.

0 comments on commit 377e247

Please sign in to comment.