Skip to content

Instantly share code, notes, and snippets.

View rtanglao's full-sized avatar
😃
you rock :-)

Roland Tanglao rtanglao

😃
you rock :-)
View GitHub Profile
@rtanglao
rtanglao / 2010colours.txt
Created October 1, 2010 16:39
drawAvgColourDotsOf812-2010OlympicCameraphonePics
7822173
4412250
2767443
5792370
6975344
4938362
4546689
3367065
1903883
11500119
@rtanglao
rtanglao / GastownColours.pde
Created October 1, 2010 16:48
drawAvgColourDotsOf3700GastownCameraPhonePhotosOfGastown
// original code by jer thorpe apri 2010
// hacked by roland tanglao september 2010
void setup() {
//This code happens once, right when our sketch is launched
size(800,600);
background(255);
smooth();
//Ask for the list of numbers
@rtanglao
rtanglao / gttopicURLs.rb
Created October 5, 2010 19:27
gettopicURLs.rb
#!/usr/bin/env ruby
require 'json'
require 'net/http'
require 'pp'
require 'Time'
def getResponse(url)
http = Net::HTTP.new("api.getsatisfaction.com",80)
@rtanglao
rtanglao / calculateAvgColourNumber.rb
Created October 12, 2010 17:44
calculateAvgColourNumber.rb
#!/usr/bin/env ruby
require 'json'
require 'pp'
pages = 0
total = 0
perpage = 0
r, g, b = 0, 0, 0
total_photos = 0
@rtanglao
rtanglao / get18PlaceInfo.rb
Created November 8, 2010 07:26
get18PlaceInfo.rb
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require 'json'
require 'net/http'
require 'pp'
require 'Time'
require 'uri'
require 'parseconfig'
def getResponse(url)
@rtanglao
rtanglao / sleepyMongooseJSWhereQuery
Created February 24, 2011 03:40
sleepy mongoose JS $where query to find all topics with "comcast" AND "send" and just return the at_sfn url field and sorted by last_active_at
# the trick is to escape any double quotes in the $where queries with "\" i.e %5C
http://localhost:27080/gs/topics/_find?criteria=%7B%22%24where%22%3A%22this.fulltext.indexOf%28%5C%22comcast%5C%22%29%20%21%3D%20-1%20%26%26%20this.fulltext.indexOf%28%5C%22send%5C%22%29%20%21%3D%20-1%22%7D&fields=%7B%22at_sfn%22%3A%221%22%7D&sort=%7B%22last_active_at%22%3A%22-1%22%7D
# or using CURL:
curl -X GET 'http://localhost:27080/gs/topics/_find?criteria=%7B%22%24where%22%3A%22this.fulltext.indexOf%28%5C%22comcast%5C%22%29%20%21%3D%20-1%20%26%26%20this.fulltext.indexOf%28%5C%22send%5C%22%29%20%21%3D%20-1%22%7D&fields=%7B%22at_sfn%22%3A%221%22%7D&sort=%7B%22last_active_at%22%3A%22-1%22%7D'
@rtanglao
rtanglao / tikiToKitsuneWikiSyntax.md
Created March 2, 2011 17:19
how to convert SuMoMo Tiki Wiki kb article content to Kitsune Syntax
  • export PYTHONPATH=/Users/rolandtanglao/Documents/MOZILLA_MESSAGING/KITSUNE/TIKI_TO_KITSUNE_CONVERSION_CODE/pcraciunoiu-kitsune-531b784/apps
  • get the KB article text files as .txt files from Gozer, see bug 6345657
  • for i in *.txt; do cat "$i" | ~/Documents/MOZILLA_MESSAGING/KITSUNE/TIKI_TO_KITSUNE_CONVERSION_CODE/kitsune/apps/sumo/convertSuMoMoKBfiles.py 1> CONVERTED_TO_KITSUNE/"$i".stdout.txt 2> CONVERTED_TO_KITSUNE/"$i".stderr.txt; done
@rtanglao
rtanglao / findingSpamImagesInSuMoMoTiki.md
Created March 2, 2011 17:31
How to find spam images in tiki wiki before upgrading to tiki
  • cd to the directory with the articles from :gozer bug 634657
  • assuming all the images in articles aren't spam, then find all the unique images in the articles:
    • egrep -h -o '{img src="img/wiki_up/[^-]*-[^-]*-[^-]*-[^\.]*.(jpeg|jpg|png|PNG|JPG)[^&]*"[a-zA-Z0-9 &;=}]*' * | sort | uniq > unique_sumomo_images_1march_2011.txt [file0]
    • egrep -o '[0-9a-f]{32}-[0-9]{10}-[0-9]{1,3}-[0-9]{1}.(png|PNG|jpg|JPG|jpeg|JPEG|gif|GIF)' unique_sumomo_images_1march_2011.txt > just.unique.image.filenames.1march2011.txt [file1]
  • open up those images from :sancus bug 634667 in [file1] and see if any are spam, if so update [file1] by removing them from [file1]
  • find the spam images by removing the known good images from [file1]
    • var=`cat /Users/rolandtanglao/Documents/MOZILLA_MESSAGING/KITSUNE/TIKI_WIKI_ARTICLES/sumo/just.unique.image.filenames.1march2011.txt`
    • `grep -v "$var
@rtanglao
rtanglao / 1stCommit to kitsune
Created March 28, 2011 21:58
did i do this right?
Roland-Tanglaos-MacBook-Pro-2:landings rolandtanglao$ git diff
diff --git a/apps/landings/templates/landings/home.html b/apps/landings/template
index 3cf61a3..7f517aa 100644
--- a/apps/landings/templates/landings/home.html
+++ b/apps/landings/templates/landings/home.html
@@ -1,9 +1,9 @@
{# vim: set ts=2 et sts=2 sw=2: #}
{% extends "landings/base.html" %}
{% set classes = ('home desktop') %}
-{% set title = _('Firefox Support Home Page') %}
@rtanglao
rtanglao / tartThunderbirdFullLogging.command
Created March 30, 2011 23:26
turn on all Thunderbird Logs in Mac OS X
#!/bin/sh
export NSPR_LOG_MODULES=imap:5,smtp:5,pop3:5,ldap:5,ImapAutoSync:5,MSGDB:5,timestamp
export NSPR_LOG_FILE=tb.log
/Applications/Thunderbird.app/Contents/MacOS/thunderbird-bin &