Skip to content

Instantly share code, notes, and snippets.

Avatar

Marty Pitt martypitt

  • London
View GitHub Profile
View gist:9496603
## How many messages has Todd receied, by day?
select DATE(cm.`receivedDate`), count(*) from Inbox inbox
inner join InboxMessage im on inbox.id = im.`inbox_id`
inner join ChannelMessage cm on im.`message_id` = cm.id
where inbox.`user_id` = 2
group by DATE(cm.`receivedDate`)
order by DATE(cm.`receivedDate`) desc;
## What channels did Todds messages come from on March 6th?
select channel_id, count(*)
View javac-dtruss.txt
PID/THRD SYSCALL(args) = return
5310/0xfd0a: close(0x3) = 0 0
5310/0xfd0a: __sysctl(0x7FFF521225C8, 0x2, 0x7FFF521225D8) = 0 0
5310/0xfd0a: thread_selfid(0x7FFF7912D310, 0x7FFF7912D258, 0x10101) = 64778 0
5310/0xfd0a: bsdthread_register(0x7FFF8E459FBC, 0x7FFF8E459FAC, 0x2000) = 0 0
5310/0xfd0a: mprotect(0x10DAEA000, 0x88, 0x1) = 0 0
5310/0xfd0a: mprotect(0x10DAFD000, 0x1000, 0x0) = 0 0
5310/0xfd0a: mprotect(0x10DB13000, 0x1000, 0x0) = 0 0
5310/0xfd0a: mprotect(0x10DB14000, 0x1000, 0x0) = 0 0
5310/0xfd0a: mprotect(0x10DB2A000, 0x1000, 0x0) = 0 0
View AutoFlushingPumpStreamHandler
package com.mangofactory.typescript.tss.io;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import org.apache.commons.exec.ExecuteStreamHandler;
import org.apache.commons.exec.InputStreamPumper;
import org.apache.commons.exec.PumpStreamHandler;
import org.apache.commons.exec.StreamPumper;
View AbstractTradingMarket.java
package com.mangofactory;
import javax.persistence.Entity;
import javax.persistence.MappedSuperclass;
import javax.persistence.OneToOne;
@Entity
public abstract class AbstractTradingMarket<T extends Tradable> implements Market<T>{
@OneToOne
@martypitt
martypitt / gist:5611982
Created May 20, 2013
Remote deploy with Cargo Daemon
View gist:5611982
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mangofactory.joose</groupId>
<artifactId>deployment.test</artifactId>
<version>1.0</version>
<packaging>war</packaging>
<name>Maven Webapp</name>
View pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mangofactory.joose</groupId>
<artifactId>deployment.test</artifactId>
<version>1.0</version>
<packaging>war</packaging>
<name>Maven Webapp</name>
@martypitt
martypitt / cargo.conf
Created May 20, 2013
Conf file for cargo
View cargo.conf
# Cargo - Tomcat deployment manager
description "Cargo - Tomcat deploymnet manager"
start on filesystem or runlevel [2345]
stop on runlevel [!2345]
env HOME_DIR=/home/ubuntu/.cargo
exec /usr/bin/java -jar /home/ubuntu/cargo-daemon-webapp-1.4.0.war -Ddaemon.home=${HOME_DIR} -Dcargo.home=${HOME_DIR} >> /var/log/cargo.log
@martypitt
martypitt / gist:6183822
Last active Dec 20, 2015
These tests fail, demonstrating either a bug somewhere in the Jackson / Spring-Data-Redis stack, or a configuration problem within my code. It requires Lombok to run
View gist:6183822
package com.mangofactory.example
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.hasSize;
import static org.junit.Assert.assertThat;
import java.util.Collections;
import java.util.List;
View gist:6184111
package com.mangofactory.example;
import java.util.Map;
import lombok.SneakyThrows;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.map.type.TypeFactory;
import org.codehaus.jackson.type.JavaType;
import org.springframework.data.redis.hash.HashMapper;
View gist:6363263
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 15.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="800px" height="311.002px" viewBox="0 144.5 800 311.002" enable-background="new 0 144.5 800 311.002"
xml:space="preserve">
<g>
<path d="M311.11,144.5c34.571,0,69.133,0,103.707,0C587.188,182.275,743.864,144.458,800,292.593c0,4.948,0,9.864,0,14.812
c-70.312,6.101-77.84-50.533-148.146-44.428c10.745,63.305,83.185,64.935,118.515,103.666
c-36.232,30.429-85.749-51.858-148.147-44.428c-13.367,23.996,34.687,112.851,88.893,118.479c0,4.945,0,9.859,0,14.808