Skip to content

Instantly share code, notes, and snippets.

View ssedano's full-sized avatar

Serafin Sedano ssedano

View GitHub Profile
@ssedano
ssedano / gist:1566498
Created January 5, 2012 18:23
awaitCompletion
public void awaitCompletion(final Task task)
{
Predicate<Task> jobComplete = TaskPredicates.done(); // evals the task.getState()
System.out.println("Hola!" + task.getState() + " " + task.getTaskId());
RetryablePredicate<Task> r =
new RetryablePredicate<Task>(jobComplete, 3600000l);
r.apply(task);
}
@ssedano
ssedano / TaskStatus
Created January 20, 2012 15:24
new TaskStatus
/**
* Abiquo community edition
* cloud management application for hybrid clouds
* Copyright (C) 2008-2010 - Abiquo Holdings S.L.
*
* This application is free software; you can redistribute it and/or
* modify it under the terms of the GNU LESSER GENERAL PUBLIC
* LICENSE as published by the Free Software Foundation under
* version 3 of the License
*
@ssedano
ssedano / gist:1900851
Created February 24, 2012 13:18
Naive and crappy regexp (eclipse)
Remember: does not take into account void methods (no @Produces) both out and in are the same return value.
(@GET(\n\s+@.*)*)\n(\s+public\s)(\w*Dto)
\1 @Produces(\4.MEDIA_TYPE) \3 \4
(@POST(\n\s+@.*)*)\n(\s+public\s)(\w*Dto)
\1 @Consumes(\4.MEDIA_TYPE) @Produces(\4.MEDIA_TYPE) \3 \4
(@PUT(\n\s+@.*)*)\n(\s+public\s)(\w*Dto)
\1 @Consumes(\4.MEDIA_TYPE) @Produces(\4.MEDIA_TYPE) \3 \4
@ssedano
ssedano / mysql_debug
Created May 8, 2012 13:22
some mysql watch commands
-- Mysql processlist
watch -n 0.1 'mysql -uroot -proot kinton -e "select * from information_schema.PROCESSLIST"'
-- Mysql contention
watch -n 0.1 "mysql -uroot -proot kinton -e \"select * from information_schema.PROCESSLIST where state = 'User lock'\""
-- gdb Mysql (full credits to http://poormansprofiler.org)
#!/bin/bash
nsamples=1
sleeptime=0
@ssedano
ssedano / gist:3945358
Created October 24, 2012 10:23
mapping
package com.abiquo.scheduler;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
@ssedano
ssedano / Bash_Query
Created November 8, 2012 14:48
Small bash function to allow queries straight on the prompt.
function m {
for PARAM in "$@"
do
PARAMS="${PARAMS} ${PARAM}"
done
mysql -u[user] -p[password] -e "${PARAMS}" kinton
@ssedano
ssedano / omshell_example
Created October 25, 2013 14:39
omshell example
new host
set name = "b"
set hardware-address = f0:4d:a2:fd:2d:74
set ip-address = 20:02:ca:fe:00:00:00:00:00:00:00:00:00:00:00:07,20:02:ca:fe:00:00:00:00:00:00:00:00:00:00:00:08
set hardware-type = 1
set statements = "option dhcp6.vendor-opts 6f:70:74:69:6f:6e;"
create