Skip to content

Instantly share code, notes, and snippets.

<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="failure">
<xs:complexType mixed="true">
<xs:attribute name="type" type="xs:string" use="optional"/>
<xs:attribute name="message" type="xs:string" use="optional"/>
</xs:complexType>
</xs:element>
@kuzuha
kuzuha / README.md
Last active November 24, 2017 15:30

WHAT HAPPEND

provder configuration interpolation behavior seems changed since terraform 0.11.0.

before 0.11.0, values that from data resource variable in provider configuration came from terraform.state.
AFTER apply, values in terraform.state will be changed.
new values will be used when NEXT plan.

after 0.11.0, values that from data resource variable in provider configuration came from themselves.
new values are used IMMEDIATELY.

import Ordering.Implicits._
case class Version(name: String, numbers: (Int, Int, Int, Int)) extends AnyRef with Ordered[Version] {
def compare(other: Version) = if (numbers == other.numbers) 0 else if (numbers < other.numbers) -1 else 1
}
@kuzuha
kuzuha / gist:8106846
Created December 23, 2013 23:59
fact20 bench in scala/node/java
% scala/bench 100000000 factorial20 factorial20 factorial20
# factorial20
## 3.9219999999999997
# factorial20
## 3.295
# factorial20
## 3.3129999999999997
% node/bench 100000000 factorial20 factorial20 factorial20
# factorial20
./perl6
> class t{}
t()
> role r{method hello{say 'hello'}}
r()
> class t_r does r {}
t_r()
> t_r.new().hello()
hello
> (t.new does r).hello()
{
"instrumentation": "node-jscoverage",
"sloc": 3,
"hits": 2,
"misses": 1,
"coverage": 66.66666666666666,
"files": [
{
"filename": "build/main/js/sample-project.js",
"coverage": 66.66666666666666,
@kuzuha
kuzuha / gist:5378735
Last active December 16, 2015 04:39
testem android emulator proxy command
#!/bin/sh
URL=`perl -e '$in="'$1'"; $in =~ s/localhost/10.0.2.2/; print $in;'`
$ANDROID_SDK_HOME/platform-tools/adb shell am start -a android.intent.action.VIEW -d $URL
php -r '$a=[]; $a[]=2; $a[-1]=1; var_dump($a); array_shift($a); var_dump($a);'
array(2) {
[0]=>
int(2)
[-1]=>
int(1)
}
array(1) {
[0]=>
int(1)
<?php
function array_slide(&$array, $key, $amount) {
if ($amount === 0) {
return;
}
$keys = array_keys($array);
$values = array_values($array);
$target = array($keys[$key] => $values[$key]);
$left = array_slice($array, 0, $key);
@kuzuha
kuzuha / gist:3520393
Created August 29, 2012 23:33
tcpdump filter
#!/usr/bin/env perl
$buf = '';
while(<STDIN>) {
$flag = $_ =~ m/^\s+0x[\da-f]{4}: /;
if (!$flag) {
$buf =~ s/\s//g;
$buf =~ s/[0-9A-Fa-f][0-9A-Fa-f]/pack("C", hex $&)/eg;
$buf = substr($buf, 52);