Skip to content

Instantly share code, notes, and snippets.

@GET
@Produces({"application/atom+xml"})
public Response getChannelPermission (@PathParam(ACCOUNT_ELEMENT) String accountId) {
final Feed feed = generateChannelAtomFeed(accountId);
StreamingOutput s = new StreamingOutput() {
@Override
public void write(OutputStream output) throws IOException,
WebApplicationException {
XmlWriter writer = new XmlWriter(new OutputStreamWriter(output));
mysql> select nick, count(*) c from messages group by nick order by c desc;
+------------------+-------+
| nick | c |
+------------------+-------+
| jvolkman | 11629 |
| mmattozzi | 9547 |
| mblinn | 9017 |
| aevans | 7589 |
| mhawthorne | 5247 |
| bschmaus | 2543 |
@mmattozzi
mmattozzi / best of aevans
Created October 28, 2009 17:41
Best of aevans
message
so, yeah, but i don't think he's really technical
so, there is a post about it
so, there are a lot of discussion in the fancast group about ping and pong
so, if we built awesome stuff that they couldn't build the situation would probably be different
so, there are a few problems
so, we have one awful painful system that sucks because data integration/ingestion is hard, and we make the problem even harder by trying to reconcile two of these two systems into one
so, i think we have a lesson to learn: which is that some systems are technically straightforward but too much effort to produce and maintain
so, who woudl 'we' be
so, that's not a bad model
delimiter $$
create trigger HELLO_CUSTOM_FIELD_INSERT_TRIGGER after insert on HELLO_CUSTOM_FIELD for each row
begin
declare l_count int default 0;
select count(*)
from HELLO_CUSTOM_FIELD hcf
where
hcf.owner_uri_path_id = new.owner_uri_path_id and
hcf.owner_uri_ref = new.owner_uri_ref and
hcf.namespace_prefix = new.namespace_prefix and
#!/usr/bin/perl -w
use LWP::Simple;
use HTML::LinkExtor;
use Data::Dumper;
use DBI;
my $dbh = DBI->connect("DBI:mysql:db", "user", "password", {RaiseError => 1});
my $url = "http://lostpedia.wikia.com/wiki/Pilot,_Part_1_transcript";
protected <T> List<List<T>> permutate(List<T> list) {
if (list == null) {
return null;
} else if (list.size() == 1) {
return Arrays.asList(list);
} else if (list.size() == 2) {
List<T> revList = new ArrayList<T>();
revList.addAll(list);
Collections.reverse(revList);
return Arrays.asList(list, revList);
@mmattozzi
mmattozzi / logTimes.pl
Created February 18, 2011 15:41
Calculate percentile latencies based on stdin containing (\d+)\s{0,1}ms somewhere in the line
#!/usr/bin/perl -w
my @lines = <STDIN>;
my $totalTime = 0;
my $count = 0;
my @responseTimes = [];
for my $line (@lines) {
@mmattozzi
mmattozzi / gist:853024
Created March 3, 2011 16:15
OSX: Changing iterm tab with each cd
I created a perl script:
#!/usr/bin/perl -w
my $dir = `pwd`;
chomp $dir;
$dir =~ s/\/trunk$//;
$dir = substr($dir, rindex($dir, "/") + 1);
print "\033]0;$dir\007";
Then set the PROMPT_COMMAND variable in my ~/.bash_profile:
(function() {
if (document.URL.match(/beermenus\.com\/places/)) {
var trs = document.getElementsByTagName("tr");
var minPpoz = null;
for (var i = 0; i < trs.length; i++) {
var tds = trs[i].children;
var name = null;
var serving = null;
var abv = null;
var price = null;
@mmattozzi
mmattozzi / List postgres indexes and sizes
Last active December 15, 2015 12:09 — forked from next2you/Postgres Index Usage.sql
Displaying indexes in a postgres db
SELECT idx.relname as table,
idx.indexrelname as index,
pg_relation_size( idx.indexrelname::text ) as bytes,
cls.relpages as pages,
cls.reltuples as tuples,
idx.idx_scan as scanned,
idx.idx_tup_read as read,
idx.idx_tup_fetch as fetched
FROM pg_stat_user_indexes idx,
pg_class cls ,