Skip to content

Instantly share code, notes, and snippets.

@dmachi
dmachi / build.def
Created November 1, 2023 15:09
basic install for bv-brc-cli tools
Bootstrap: docker
From: debian:12-slim
%post
cd /tmp
apt-get update
apt-get install -y curl gdebi locales
export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
from sanic import Sanic
from sanic.response import json,text
import asyncio
app = Sanic("service")
# import concurrent
# thread_pool = concurrent.futures.ThreadPoolExecutor()
async def do_step(step,duration,opts={}):
define([
'intern!object',
'intern/chai!assert',
'intern/dojo/request',
'intern/dojo/node!../data-model',
'intern/dojo/promise/All'
], function (registerSuite, assert, request,dataModel,All) {
var suite = {
name: "Data Model Tests"
}
@dmachi
dmachi / gist:5613121
Created May 20, 2013 15:49
select visible nodes in a dgrid
var dh = domGeom.getMarginBox(grid.contentNode).h;
var scrollPos = grid.getScrollPosition();
var rows = Query(".dgrid-row",grid.contentNode).filter(function(node){
return ((node.offsetTop>=scrollPos.y) && ((node.offsetTop + (.75 * node.offsetHeight)) <(scrollPos.y+dh)));
});
grid.clearSelection();
grid.select(rows[0], rows[rows.length-1]);
@dmachi
dmachi / gist:2934029
Created June 15, 2012 01:13
Custom dGrid in ContentPane that resizes
define(["dojo/_base/declare", "dgrid/OnDemandGrid", "dgrid/extensions/DijitRegistry","dojo/dom-geometry"],
function(declare,Grid,DijitRegistryExt,domGeometry) {
return declare([Grid,DijitRegistryExt], {
resize: function(){
if (arguments.length>0){
domGeometry.setMarginBox(this.domNode, arguments[0]);
}
this.inherited("resize", arguments);
}
});
@dmachi
dmachi / apt.py
Created June 1, 2012 17:34
Gluster Plugin for StarCluster
from starcluster.clustersetup import ClusterSetup
from starcluster.logger import log
class addRepository(ClusterSetup):
def __init__(self, repositories=None):
self.repositories=repositories
if self.repositories:
self.repositories= [repo.strip() for repo in repositories.split(',')]
@dmachi
dmachi / gist:1595210
Created January 11, 2012 15:35
tbz2 serializer
Media({
mediaType: "application/x-bzip-compressed-tar",
getQuality: function(object){
if (object && object.manifest && object.manifest.length>0){
return 1;
}
return 0;
},
serialize: function(object, parameters, request){
//console.log("Serialize object to tbz: ", object, parameters, request);
cid-59fd47:lrs dmachi$ rm -rf downloaded-modules/
cid-59fd47:lrs dmachi$ node $NODULES
Downloading http://github.com/kriszyp/commonjs-utils/zipball/v0.2.2
request url: http://github.com/kriszyp/commonjs-utils/zipball/v0.2.2
Downloading http://github.com/kriszyp/pintura/zipball/v0.2.6
request url: http://github.com/kriszyp/pintura/zipball/v0.2.6
Downloading http://github.com/kriszyp/multi-node/zipball/v0.2.2
request url: http://github.com/kriszyp/multi-node/zipball/v0.2.2
Downloading http://github.com/kriszyp/perstore/zipball/v0.2.4
request url: http://github.com/kriszyp/perstore/zipball/v0.2.4
@dmachi
dmachi / wrapperStore
Created August 18, 2011 15:34
getting started with wrapping two stores with one
var store = function(substores,options){
return {
query: function(query){
var defs=[];
var results=[]
substores.forEach(function(sub,index){
defs.push(when(sub.query(query), function(resultSet){
results[index]=resultSet;
}));
@dmachi
dmachi / scroll.html
Created April 22, 2011 02:51
scrollbar approximation
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"/>
<meta name="apple-mobile-web-app-capable" content="yes" />
<title>EdgeToEdgeDataList</title>
<link href="../themes/iphone/base.css" rel="stylesheet">
<link href="../themes/iphone/TabBar.css" rel="stylesheet"></link>