Skip to content

Instantly share code, notes, and snippets.

@laclefyoshi
laclefyoshi / test_featurefu_snippet.java
Last active Sep 6, 2015
FeatureFuを使ってみた
View test_featurefu_snippet.java
// https://github.com/laclefyoshi/test_featurefu/blob/master/src/test/java/org/saekiyoshiyasu/OperationTest.java
// assertEquals(expected, actual, delta)
assertEquals(evaluator("(== a b)", 1.2, 1.3), 0.0, 0); // false == 0.0
assertEquals(evaluator("(== a b)", 2.5, 2.5), 1.0, 0); // true == 1.0
assertEquals(evaluator("(!= a b)", 1.2, 1.3), 1.0, 0);
assertEquals(evaluator("(> a b)", 1.3, 1.3), 0.0, 0);
assertEquals(evaluator("(< a b)", 2.3, 2.5), 1.0, 0);
assertEquals(evaluator("(>= a b)", 1.3, 1.3), 1.0, 0);
assertEquals(evaluator("(<= a b)", 2.3, 2.5), 1.0, 0);
assertEquals(evaluator("(max a b)", 1.2, 1.3), 1.3, 0);
View perfect.applescript
tell application "iTunes"
activate
set newPreset to make new EQ preset
set name of newPreset to "Perfect"
set band 1 of newPreset to 3
set band 2 of newPreset to 6
set band 3 of newPreset to 9
set band 4 of newPreset to 7
set band 5 of newPreset to 6
set band 6 of newPreset to 5
View eargasm_explosion.applescript
tell application "iTunes"
activate
set newPreset to make new EQ preset
set name of newPreset to "Eargasm Explosion"
set band 1 of newPreset to 3
set band 2 of newPreset to 6
set band 3 of newPreset to 9
set band 4 of newPreset to 7
set band 5 of newPreset to 6
set band 6 of newPreset to 5
View gist:8627542
$ say -v \?
Agnes en_US # Isn't it nice to have a computer that will talk to you?
Albert en_US # I have a frog in my throat. No, I mean a real frog!
Alex en_US # Most people recognize me by my voice.
Bad News en_US # The light you see at the end of the tunnel is the headlamp of a fast approaching train.
Bahh en_US # Do not pull the wool over my eyes.
Bells en_US # Time flies when you are having fun.
Boing en_US # Spring has sprung, fall has fell, winter's here and it's colder than usual.
Bruce en_US # I sure like being inside this fancy computer
Bubbles en_US # Pull the plug! I'm drowning!
@laclefyoshi
laclefyoshi / gist:8627514
Created Jan 26, 2014
Google Chrome voices
View gist:8627514
> var msg = new SpeechSynthesisUtterance()
undefined
> msg
SpeechSynthesisUtterance {onboundary: null, onmark: null, onresume: null, onpause: null, onerror: null…}
lang: ""
onboundary: null
onend: null
onerror: null
onmark: null
View reformed scalastyle outputs
$ ./scalastyle.sh Documents/Projects/scala/URLHandle.scala
/Volumes/Macintosh HD/Users/yoshiyasu/Documents/Projects/scala/URLHandle.scala:45:2:warning: Whitespace at end of line
/Volumes/Macintosh HD/Users/yoshiyasu/Documents/Projects/scala/URLHandle.scala:35:16:warning: Avoid using null
/Volumes/Macintosh HD/Users/yoshiyasu/Documents/Projects/scala/URLHandle.scala:47:3:warning: Regular expression matched 'println'
/Volumes/Macintosh HD/Users/yoshiyasu/Documents/Projects/scala/URLHandle.scala:55:3:warning: Regular expression matched 'println'
/Volumes/Macintosh HD/Users/yoshiyasu/Documents/Projects/scala/URLHandle.scala:14:15:warning: Public method must have explicit type
/Volumes/Macintosh HD/Users/yoshiyasu/Documents/Projects/scala/URLHandle.scala:32:15:warning: Public method must have explicit type
View emacs.el
(defun flymake-scalastyle-init ()
(let* ((temp-file (flymake-init-create-temp-buffer-copy
'flymake-create-temp-inplace))
(local-file (file-relative-name
temp-file
(file-name-directory buffer-file-name))))
(list "~/.local/bin/scalastyle.sh" (list local-file))))
(add-to-list 'flymake-allowed-file-name-masks
'("\\.scala\\'" flymake-scalastyle-init))
(add-hook 'scala-mode-hook
View scalastyle.sh
#!/bin/sh
java -jar ~/.local/src/scalastyle-batch_2.10-0.3.2/scalastyle-batch_2.10.jar \
--config ~/.local/src/scalastyle-batch_2.10-0.3.2/scalastyle_config.xml "$1" \
| python -c \
'import re
format = re.compile(r"^(\S+) +file=(.+?) +message=(.+?) +line=(\d+) +column=(\d+)$")
while True:
s = ""
try:
View scalastyle outputs
$ java -jar ~/.local/src/scalastyle-batch_2.10-0.3.2/scalastyle-batch_2.10.jar \
--config ~/.local/src/scalastyle-batch_2.10-0.3.2/scalastyle_config.xml \
Documents/Projects/scala/URLHandle.scala
warning file=/Volumes/Macintosh HD/Users/yoshiyasu/Documents/Projects/scala/URLHandle.scala message=Header does not match expected text line=1
warning file=/Volumes/Macintosh HD/Users/yoshiyasu/Documents/Projects/scala/URLHandle.scala message=Whitespace at end of line line=46 column=2
warning file=/Volumes/Macintosh HD/Users/yoshiyasu/Documents/Projects/scala/URLHandle.scala message=Avoid using null line=36 column=16
warning file=/Volumes/Macintosh HD/Users/yoshiyasu/Documents/Projects/scala/URLHandle.scala message=Regular expression matched 'println' line=48 column=3
warning file=/Volumes/Macintosh HD/Users/yoshiyasu/Documents/Projects/scala/URLHandle.scala message=Regular expression matched 'println' line=56 column=3
warning file=/Volumes/Macintosh HD/Users/yoshiyasu/Documents/Projects/scala/URLHandle.scala mes
@laclefyoshi
laclefyoshi / configuration.xml
Last active Dec 23, 2015
oozie workflow.xml for using scalding as Java Action
View configuration.xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<property>
<name>jobTracker</name>
<value>master.saekiyoshiyasu.org:8021</value>
</property>
<property>
<name>nameNode</name>
<value>hdfs://master.saekiyoshiyasu.org:8020</value>
</property>