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 / roland-kitsune-git-workflow.md
Created April 27, 2011 22:45
Roland's Kitsune Git Workflow

setup repo

git clone git@github.com:rtanglao/kitsune.git
git remote add upstream git@github.com:Sancus/kitsune.git
git checkout staging in git 1.7 or git checkout -t origin/staging depending on git version in git 1.6 you need to use git checkout -t origin/staging !
git fetch upstream
git merge upstream/staging

create branch

git checkout -b tb-sidebar  #create and make new branch e.g. tb-sidebar branch

... make changes

git add blah blah

@rtanglao
rtanglao / getNullMsgStrs.sh
Created May 6, 2011 23:18
how to find msgstrs that are nil
cd /Users/rolandtanglao/Documents/MOZILLA_MESSAGING/KITSUNE/LOCALE_CHECKOUT/trunk/locales
for i in *; do echo -n $i >>no.of.nil.msgstrs.txt;grep -H "msgstr \"\"" "$i"/LC_MESSAGES/messages.po | wc -l >> no.of.nil.msgstrs.txt; done ;cat no.of.nil.msgstrs.txt | sort -r --key=2 >sorted.by.number.of.nil.strs
@rtanglao
rtanglao / howManyTopicsWithUnResponsive.sh
Created May 31, 2011 00:13
how many topics have the word unresponsive in them since I started July 21, 2009?
> db.topics.find({"$where":"this.fulltext.indexOf(\"unresponsive\") != -1"}).count()
95
> db.topics.find({"$where":"this.fulltext_with_tags.indexOf(\"unresponsive\") != -1"}).count()
65
# This 65 sounds like a bug in my Mongo Database i.e. a bug in :
# https://github.com/rtanglao/momogs/blob/master/mongoSlurpGS.rb
@rtanglao
rtanglao / getNumberOfGetSatisfactionTopicsUnified2010Aug1-2011Jan1.md
Created May 31, 2011 04:15
getNumberOfGetSatisfactionTopics w/"unified" between 2010 1 Aug to 2011 1 Jan

Answer: 107 topics created with the word "unified" from Aug 1, 2010 to Jan 1, 2011

> use gs
switched to db gs
> var  start = new Date(Date.UTC(2010,7,1));                                                                          
> var end = new Date(Date.UTC(2011,0,1));    
> db.topics.findOne({"created_at": {$gte: start, $lt:end},"$where":"this.fulltext.indexOf(\"unified\") != -1"},{"at_sfn":"1"});
{
"_id" : ObjectId("4d7b48cdcf3298130900024e"),
"at_sfn" : 

"http://getsatisfaction.com/mozilla_messaging/topics

@leibovic
leibovic / dominant-color.js
Created June 9, 2011 16:27
Dominant Color
function getDominantColor(aImg) {
let canvas = document.createElement("canvas");
canvas.height = aImg.height;
canvas.width = aImg.width;
let context = canvas.getContext("2d");
context.drawImage(aImg, 0, 0);
// keep track of how many times a color appears in the image
let colorCount = {};
@rtanglao
rtanglao / oneGetSatisfactionTopicFromRolandsMongoDBinRuby.rb
Created June 11, 2011 04:46
oneGetSatisfactionTopicFromRolandsMongoDBinRuby
p = topicsColl.find_one()
pp p
{"_id"=>BSON::ObjectId('4de6c57bcf32980220000010'),
"me_too_count"=>1,
"slug"=>"my_folders_have_disappeared",
"reply_id_array"=>[5499308, 5703224],
"created_at"=>Sat May 07 14:32:00 UTC 2011,
"user_defined_code"=>false,
"author"=>
{"name"=>"g_owen_home",
@blech
blech / favourites-set.py
Created June 29, 2011 05:09
Create a Flickr "popular" set
#!/usr/bin/python
import flickrapi
import simplejson
# here culty culty cargo cargo culty
import sys, codecs
sys.stdout = codecs.getwriter('utf-8')(sys.stdout)
@rtanglao
rtanglao / BestWayToGraphACSVFileWithYYYYMMData.R
Created July 3, 2011 05:06
R Lang Yak Shaving to convert Thunderbird Get Satisfaction "emotitag" csv data into a graph
tbl <- read.csv("/Users/rolandtanglao/Documents/MOZILLA_MESSAGING/MOMOGS/momogs/getEmotitag.200981.2011531.csv")
tbl$yyyymm <- as.Date(paste(as.character(tbl$yyyymm),"01",sep=""),format="%Y%m%d")
dfrm_long <- melt(tbl,id="yyyymm")
myplot <- ggplot(data=dfrm_long,aes(x=yyyymm,y=value, colour=variable)) + geom_line() + geom_point() + theme_bw()
ggsave(myplot,filename="blah.png",scale=1.5)
@rtanglao
rtanglao / openURLs.sh
Created July 5, 2011 23:10
open urls in a browser from brute force search of mongo db thunderbird get satisfaction topics
egrep -o "http\:\/\/[0-9a-z\.\/_]* " 5july2011.315pm.bfs.stdout.txt | xargs -n 1 open