This file contains hidden or 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
def paths(): | |
for root, dirs, files, in os.walk('path/to/www.n.g'): | |
for name in files: | |
if name == "lost+found": | |
continue | |
filepath = os.path.join(root, name) | |
yield filepath | |
def fix_url(path): | |
if mime_type in ("text/html", "other html types or make another one for xml"): |
This file contains hidden or 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
// from http://play.golang.org/p/nNyTtoRzgW | |
package main | |
import ( | |
"fmt" | |
"sync" | |
) | |
var ( |
This file contains hidden or 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
git filter-branch --index-filter 'git update-index --remove filename' <revision-before-introduction-sha1>..HEAD | |
git push --force --verbose --dry-run | |
git push --force |
This file contains hidden or 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
## Largest tables | |
db=# SELECT nspname || '.' || relname AS "table", | |
pg_size_pretty(pg_total_relation_size(C.oid)) AS "total_size" | |
FROM pg_class C | |
LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace) | |
WHERE nspname NOT IN ('pg_catalog', 'information_schema') | |
AND C.relkind <> 'i' | |
AND nspname !~ '^pg_toast' | |
ORDER BY pg_total_relation_size(C.oid) DESC |
This file contains hidden or 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 | |
// overview of crqs.go: | |
// this example app and supporting documentation enables you to query analytics data via the Core Reporting API in a completely headless manner, with | |
// no "popup" or user intervention required. it doesn't "handle" the returned data very well, as that will depend on what metrics/dimensions your | |
// query has. better handling of this is left as an exercise for the reader. :) follow the pre-reqs, change the ga* consts specific to your own app, | |
// and you should be good to go. uses google-api-go-client, analytics/v3, oauth, and oauth/jwt which you can download and install from | |
// https://code.google.com/p/goauth2/ and http://code.google.com/p/google-api-go-client/ | |
// docs/pre-reqs: |
This file contains hidden or 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 ( | |
"fmt" | |
"io/ioutil" | |
"net/http" | |
"log" | |
"regexp" | |
"strings" | |
) |
This file contains hidden or 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
[buildout] | |
extensions = mr.developer | |
parts = | |
gae_sdk | |
gae_tools | |
app_lib | |
local_appserver_deps | |
nosetests | |
# order matters so that this python overwrites the one generated by gae_tools | |
# until they publish the fix https://github.com/prmtl/appfy.recipe.gae/pull/9 |
This file contains hidden or 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
## Example from http://bit.ly/1m7DFKs | |
curl -XDELETE 'localhost:9200/my_index' | |
echo | |
curl -XPUT 'localhost:9200/my_index' -d' | |
{ | |
"settings": { | |
"analysis": { | |
"filter": { | |
"trigrams_filter": { | |
"type": "ngram", |
This file contains hidden or 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 ( | |
"bufio" | |
"fmt" | |
"io" | |
"log" | |
"os" | |
"os/exec" | |
"strings" |
This file contains hidden or 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 ( | |
"net/http" | |
"database/sql" | |
"fmt" | |
"log" | |
"os" | |
) |