Skip to content

Instantly share code, notes, and snippets.

View PaulCapestany's full-sized avatar

Paul Capestany PaulCapestany

View GitHub Profile
@PaulCapestany
PaulCapestany / wwdc_pdf_downloader.sh
Created June 15, 2013 00:13
Download all the WWDC session presentation PDFs with this one-line bash script. Simply "View Source" at https://developer.apple.com/wwdc/videos/ and Save as "wwdc_source", then run the script in terminal. Easy-peazy!
grep -o "devstreaming.*HD.mov" wwdc_source | sed 's/-HD.mov/.pdf/' > wwdc_PDF_urls && for URL in `cat wwdc_PDF_urls`; do curl -OL $URL; done
if reply.Result != nil {
if info, ok := reply.Result.(btcjson.InfoResult); ok {
fmt.Println("balance =", info.Balance)
} // else {...}
}
{
"interface": ":4984",
"adminInterface": ":4985",
"persona": {
"origin": "http://myaweomeserver.com:4984/"
},
"log": ["CRUD", "Auth", "HTTP+"],
"databases": {
"couchchat": {
"server": "http://localhost:8091",
{
"interface": ":4984",
"adminInterface": ":4985",
"log": ["CRUD", "Auth", "HTTP+"],
"databases": {
"someapp": {
"server": "http://localhost:8091",
"bucket": "someapp"
},
"couchchat": {
@PaulCapestany
PaulCapestany / myconfig.json
Created April 3, 2013 06:43
sync_gateway config file
{
"interface": ":4984",
"adminInterface": ":4985",
"log": ["CRUD", "Auth", "HTTP+"],
"databases": {
"sync_gateway": {
"server": "http://localhost:8091",
"bucket": "sync_gateway"
},
"another-app": {
@PaulCapestany
PaulCapestany / gist:5298886
Created April 3, 2013 06:27
CouchChat-iOS & sync_gateway log (having issues getting Persona authentication to work)
sync_gateway -personaOrigin="http://localhost:4984/" myconfig.json
23:10:11.849476 Opening Couchbase database couchchat on <http://localhost:8091>
23:10:11.930319 Connected to <http://localhost:8091>, pool default, bucket couchchat
23:10:11.951226 Auth: Saved user:: {"admin_channels":null,"all_channels":null,"disabled":true}
23:10:11.951237 Reset guest user to config
23:10:11.952005 Starting auth server on :4985
23:10:11.952351 Starting server on :4984 ...
23:18:09.899723 HTTP: GET /couchchat/_local/fbff5a95fd68dd1257bf38f2533294fc2b116788
23:18:09.900294 HTTP: GET /couchchat/_local/b240451141abfa19e44fcc02ba9a46ea0b096f34
#!/usr/bin/env ruby
# Giants' Shoulders Trodden Upon
# Based on the xcode auto-versioning script for Subversion by Axel Andersson
# Updated for git by Marcus S. Zarra and Matt Long
# Converted to ruby by Abizer Nasir
# Improved? By Jonathan Zhan
# Appends the number of commits on the current branch and a short git hash to the version number set in Xcode.
@PaulCapestany
PaulCapestany / Xcode-todos-and-github-README-generator.sh
Created March 27, 2013 21:40
This is an Xcode build script that turns code comments into Xcode issue warnings, creates a todo.txt for easy navigation/viewing from within the Xcode project, and also generates/updates all of the above into properly formatted markdown (including links to the lines of code for direct viewing within Github) for the README.
# turn !!!s into build warnings and generate/update README
# --------------------------------------------------------
HIGHPRIORITY="!!!:"
LOWERPRIORITY="TODO:|\?\?\?:"
# this allows us to make sure each Github link works, regardless of branch switches
CURRENTBRANCH=`cat .git/HEAD | sed 's|ref: refs/heads/||'`
VERSIONSTRING=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${PROJECT_DIR}/${INFOPLIST_FILE}")
# put notes (and temporary files to be deleted) here
mkdir -p $PROJECT_NAME/tmp
@PaulCapestany
PaulCapestany / fileserver.go
Created March 3, 2013 03:19
My static site/fileserver in Go.
package main
import (
"log"
"net/http"
"os"
)
var Home = os.Getenv("HOME")
var RequestsLogPath = Home + "/requests_log"
@PaulCapestany
PaulCapestany / oh-my-zsh prompt
Created February 8, 2013 03:07
oh-my-zsh prompt with continuously updated timestamp for every executed command ☺ (useful for troubleshooting server requests/responses when comparing against their logs, for example)
# oh-my-zsh prompt
PROMPT='%{$fg[white]%}%* ◀ %U%(0?.%{$fg_bold[magenta]%}.%{$fg_bold[red]%})%c%u %{$fg[white]%}▶ %{$reset_color%}'
PROMPT2=' %{$fg_bold[magenta]%}%c %{$fg_bold[white]%}… %_ %{$fg[white]%}▶ %{$reset_color%}'
# continuously updated timestamp for every executed command ☺
schedprompt() {
emulate -L zsh
zmodload -i zsh/sched
integer i=${"${(@)zsh_scheduled_events#*:*:}"[(I)schedprompt]}
(( i )) && sched -$i