Skip to content

Instantly share code, notes, and snippets.

@amaya382
amaya382 / cs.cs
Created April 14, 2015 11:08
既に定義済みのものを後からInterfaceとして公開する, 型チェック付きのダックタイピングっぽい感覚…?
public class Named : Person, IImplName { }
public interface IImplName
{
string Name { get; set; }
}
public class Person
{
public string Name { get; set; }
}
@amaya382
amaya382 / agg.zsh
Last active February 4, 2016 17:07
calculate avg without outliers(arg1: command, arg2: output file, arg3: regex for output, -i=--iters(opt): #iters, -o=--outliers(opt): #outliers, -a+=--additional-regex(opt,experimental): regex for additional target)
#!/bin/zsh
# TODO: impl for two or more additional regexs
zparseopts -D -A opts -- i: -iters:=i o: -outliers:=o p: -parallel=p a+: -additional-regex:=a
niters=5
noutliers=1
regexs=("$3")
local -A opts
if [[ -n "${opts[(i)-i]}" ]]; then
niters=${opts[-i]}
implicit class RichMutableMap[K, V](val m: scala.collection.mutable.Map[K, V]) extends AnyVal {
def upsert(key: K, insertValue: => V, updateValue: => V => V = null): scala.collection.mutable.Map[K, V] = {
if (m.contains(key) && updateValue != null)
m.update(key, updateValue(m(key)))
else
m.update(key, insertValue)
m
}
}
@amaya382
amaya382 / guidepost.plantuml
Last active October 11, 2017 05:50
scala.collection選択フローチャート(http://plantuml.com/plantuml/uml に投げると見れます)
@startuml
start
if (複数の型) then (Y)
:shapeless.HList;
detach
else (N)
if (順序が重要) then (Y)
if (規則的な値を生成) then (Y)
:immutable.Range;
detach
@amaya382
amaya382 / SkeletonUDAF.java
Last active September 21, 2016 04:38
skeleton for GenericUDAF
package somewhere;
import org.apache.hadoop.hive.ql.exec.Description;
import org.apache.hadoop.hive.ql.exec.UDFArgumentLengthException;
import org.apache.hadoop.hive.ql.exec.UDFArgumentTypeException;
import org.apache.hadoop.hive.ql.metadata.HiveException;
import org.apache.hadoop.hive.ql.parse.SemanticException;
import org.apache.hadoop.hive.ql.udf.generic.AbstractGenericUDAFResolver;
import org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator;
import org.apache.hadoop.hive.ql.udf.generic.GenericUDAFParameterInfo;
@amaya382
amaya382 / SkeletonUDF.java
Last active September 21, 2016 04:38
skeleton for GenericUDF
package somewhere;
import org.apache.hadoop.hive.ql.exec.Description;
import org.apache.hadoop.hive.ql.exec.UDFArgumentException;
import org.apache.hadoop.hive.ql.exec.UDFArgumentLengthException;
import org.apache.hadoop.hive.ql.exec.UDFArgumentTypeException;
import org.apache.hadoop.hive.ql.metadata.HiveException;
import org.apache.hadoop.hive.ql.udf.generic.GenericUDF;
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
@amaya382
amaya382 / TransposeAndDotUDAF.java
Created September 16, 2016 05:06
[WIP] TransposeAndDotUDAF
package hivemall.tools.matrix;
import hivemall.utils.hadoop.HiveUtils;
import hivemall.utils.hadoop.WritableUtils;
import hivemall.utils.lang.Preconditions;
import org.apache.hadoop.hive.ql.exec.Description;
import org.apache.hadoop.hive.ql.exec.UDFArgumentLengthException;
import org.apache.hadoop.hive.ql.exec.UDFArgumentTypeException;
import org.apache.hadoop.hive.ql.metadata.HiveException;
import org.apache.hadoop.hive.ql.parse.SemanticException;
#include <vector>
using namespace std;
template<typename T, size_t N>
class aligned_allocator : public allocator<T> {
using size_type = typename allocator<T>::size_type;
using pointer = typename allocator<T>::pointer;
using const_pointer = typename allocator<T>::const_pointer;

Keybase proof

I hereby claim:

  • I am amaya382 on github.
  • I am amaya (https://keybase.io/amaya) on keybase.
  • I have a public key whose fingerprint is 5194 E80C A366 3CE7 B1BD B18B C6D2 C54B 81CB 8C08

To claim this, I am signing this object:

@amaya382
amaya382 / Illustrator.exe.manifest
Last active June 16, 2018 19:19
Adobe CS6 manifest file for HiDPI on windows
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0" processorArchitecture="*"