This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import sys | |
def usage(): | |
print("python copy_layer.py <source layout JSON file> <destination layout JSON file> <copy from layer index> <copy to layer index>") | |
sys.exit(1) | |
if len(sys.argv) != 5: | |
usage() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.codahale.metrics.Clock; | |
import com.codahale.metrics.Counter; | |
import com.codahale.metrics.Gauge; | |
import com.codahale.metrics.Histogram; | |
import com.codahale.metrics.Meter; | |
import com.codahale.metrics.Metered; | |
import com.codahale.metrics.MetricFilter; | |
import com.codahale.metrics.MetricRegistry; | |
import com.codahale.metrics.ScheduledReporter; | |
import com.codahale.metrics.Snapshot; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void testSkip() throws Exception { | |
File test = File.createTempFile("blah", "blah"); | |
FileOutputStream out = new FileOutputStream(test); | |
out.getChannel().position(1024); | |
out.write(new byte[]{1, 2, 3, 4, 5, 6}); | |
out.getChannel().position(512); | |
out.write(new byte[]{6, 5, 4, 3, 2, 1}); | |
out.close(); | |
FileInputStream in = new FileInputStream(test); | |
System.err.println("Initial " + TestUtil.toHex(StreamUtil.readBytes(in, 6))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <mach/mach_time.h> | |
void logMachTime_withIdentifier_(uint64_t machTime, NSString *identifier) { | |
static double timeScaleSeconds = 0.0; | |
if (timeScaleSeconds == 0.0) { | |
mach_timebase_info_data_t timebaseInfo; | |
if (mach_timebase_info(&timebaseInfo) == KERN_SUCCESS) { // returns scale factor for ns | |
double timeScaleMicroSeconds = ((double) timebaseInfo.numer / (double) timebaseInfo.denom) / 1000; | |
timeScaleSeconds = timeScaleMicroSeconds / 1000000; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os, re, subprocess, sys | |
from xml.etree import ElementTree | |
retag = sys.argv[1] == "retag" | |
if retag: | |
del sys.argv[1] | |
source = os.path.abspath(sys.argv[1]) | |
extensionless = '.'.join(source.split('.')[:-1]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# | |
# I deliberately didn't DRY /usr/local references into a variable as this | |
# script will not "just work" if you change the destination directory. However | |
# please feel free to fork it and make that possible. | |
# | |
# If you do fork, please ensure you add a comment here that explains what the | |
# changes are intended to do and how well you tested them. | |
# | |
# 11th April 2010: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var data = [{ | |
"color": "#92BA34", | |
"data": [[1251331200000, 15.0]] | |
}, | |
{ | |
"color": "#92BA34", | |
"data": [[1251417600000, 20.0]] | |
}, | |
{ | |
"color": "#3492BA", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from junit.framework import TestCase | |
from clamp import Clamp, java, jvoid | |
class TestJUnit(Clamp, TestCase): | |
@java(jvoid) | |
def testAddition(self): | |
self.assertEquals(4, 1 + 3) |