Skip to content

Instantly share code, notes, and snippets.

View mstump's full-sized avatar
😀

Matt Stump mstump

😀
  • San Francisco, CA
View GitHub Profile
@mstump
mstump / dc_aware_policy.py
Last active August 29, 2015 13:56
Connect to a cluster using the DC aware policy
#!/usr/bin/env python
# Copyright 2014 DataStax
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
@mstump
mstump / spsc_queue.hpp
Created February 15, 2014 17:37
Design iterations of an SPSC lockfree queue
// This is free and unencumbered software released into the public domain.
// Anyone is free to copy, modify, publish, use, compile, sell, or
// distribute this software, either in source code form or as a compiled
// binary, for any purpose, commercial or non-commercial, and by any
// means.
// In jurisdictions that recognize copyright laws, the author or authors
// of this software dedicate any and all copyright interest in the
// software to the public domain. We make this dedication for the benefit
<?xml version='1.0' encoding='utf-8'?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@mstump
mstump / gist:8229155
Created January 2, 2014 23:21
90s query
/solr/coupons_nextgen_perf.UserOfferRecommendedWhite/select?fl=RecommendationId%2CUserId%2COfferId%2CPartnerId%2COfferScore%2COfferState%2COfferContext&q=UserId%3A7c8666a0-711d-11e3-8e68-005056913c67&fq=OfferState%3ARecommended&sort=OfferScore+desc%2CRecommendationId+desc&start=0&rows=10
@mstump
mstump / gist:8215862
Created January 2, 2014 07:01
Enable tomcat access logs with latency info
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log." suffix=".txt"
pattern="%h %l %u %t %r %s %b %D" resolveHosts="false"/>
@mstump
mstump / cf.sh
Last active January 1, 2016 06:19
egrep '^[[:space:]]{2}(Column Family|Write Count|Read Count)' | paste - - - |gsed 's/\t/ /g'|sed 's/ (index)//'|awk '{print $3, $6, $NF}'|sed 's/ /|/g'| sort -t'|' -k3 -n
cqlsh:demo> select * from big_index where a=0e70df33-9805-4cd2-ae94-020270b2b59c;
Request did not complete within rpc_timeout.
Tracing session: aed498e0-24d1-11e3-b5b3-8b2f9bfbfa10
activity | timestamp | source | source_elapsed
-----------------------------------------------------------------------------------+--------------+-----------+----------------
execute_cql3_query | 21:27:55,119 | 127.0.0.1 | 0
Parsing select * from big_index where a=0e70df33-9805-4cd2-ae94-020270b2b59c; | 21:27:55,119 | 127.0.0.1 | 142
Peparing statement | 21:27:55,119 | 127.0.0.1 | 521
@mstump
mstump / bit_index.cpp
Created July 9, 2013 15:22
Cross platform implementation of ffsll. Find the index of the first set bit of a 64 bit unsigned int. It uses the intrinsics available via clang, gcc and mvcc.
#include <stdint.h>
#include <iostream>
#include <boost/lexical_cast.hpp>
#ifndef ffsll
#ifdef _WIN32
inline char
ffsll(uint64_t x)
{
char index = 0x00;
@mstump
mstump / error.log
Created December 10, 2012 17:06
immutant 0.7.0 deploy errors IMMUTANT-190
╰─$ lein immutant undeploy && lein immutant deploy && lein immutant run
Undeployed courier from /Users/mstump/.lein/immutant/current/jboss/standalone/deployments
Deployed courier to /Users/mstump/.lein/immutant/current/jboss/standalone/deployments/courier.clj
Starting Immutant: /Users/mstump/.lein/immutant/current/jboss/bin/standalone.sh
=========================================================================
JBoss Bootstrap Environment
JBOSS_HOME: /Users/mstump/.lein/immutant/current/jboss
cljsc src '{:optimizations :simple :pretty-print true :target :nodejs}' > lib/sample.js