Skip to content

Instantly share code, notes, and snippets.

@nukisashineko
nukisashineko / run_idea_with_x410.ps1
Last active May 20, 2020 14:41
ideaをwslで走らせるやつ
Start-Job -ScriptBlock { "$ip_address=(Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter { IPENABLED=TRUE and ServiceName="rt640x64" }|Select IPAddress).ipaddress[0]; pengwin.exe -c "DISPLAY=${ip_address}:0.0 /opt/idea-IU-201.7223.91/bin/idea.sh" }
@nukisashineko
nukisashineko / asyncfunction_vs_AsyncFunction.js
Last active March 18, 2020 22:02
nwtgckとの会話の派生でAsyncFunction isなんぞやって確認
// MDN: https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/AsyncFunction
// 参考:https://javascript.developreference.com/article/14715429/ES+2017%3A+async+function+vs+AsyncFunction(object)+vs+async+function+expression
// Q何しようとしたの?
// A友人が話していたAsyncFunctionオブジェクトを触ってみる
// async function が利用するPromiseはグローバルではなくその場でのスコープ変数らしい。
// AsyncFunctionがスコープ変数を参照できなくしているのってPromiseが動的に書き換えられると面倒だからじゃない?って思ったので実験した
// 結果はまあよくわからなかった。
@nukisashineko
nukisashineko / HelloWorld.scala
Created September 26, 2018 18:24
scala-hello-world
class HelloWorld() {
def main (): Int ={
println("Hello World")
0
}
}
@nukisashineko
nukisashineko / blog1.png
Last active February 13, 2018 17:55
seabornでhueを使いながら、複数のグラフを重ねたかった
blog1.png
# 13日の金曜日って多めに出現するのかなって言ってた人が居たので調べたら、そんな事なかった。
# 逆に満遍なく曜日と日付が周期していてちょっと驚いたかも
# 29、30、31日の追加で上手く調整しているんだなぁ。って改めて思った。
require 'date'
hash = Hash.new(0)
(Date.new(1990,1,1)..Date.new(2017,12,31)).each do |t|
hash[[t.strftime('%a') , t.day ]]+=1
end
<!DOCTYPE html>
<!--
このソースもほぼほぼコピペ+改変。
元ソース:
https://github.com/adrai/flowchart.js/blob/master/example/index.html
-->
<html lang="en">
<head>
<meta charset="utf-8">
<title>flowchart.js · Playground</title>
@nukisashineko
nukisashineko / pixel_number_times_2.bash
Last active September 25, 2017 08:47
ffmpegで動画の撮影日時を保ったまま画素数を増やすスクリプト
mkdir mp4 -p
for file in `/bin/ls -r *.3G2`; do
datetime=`ffprobe -v quiet $file -print_format csv -show_entries format_tags=creation_time|cut -d ',' -f 2`
datetime_iso=`date --iso-8601=minutes -d "${datetime}+00:00"`
ffmpeg -i ${file} -metadata creation_time=$datetime_iso -strict -2 mp4/${file%.*}.mp4 -s 640x480 -y
touch -d $datetime_iso mp4/${file%.*}.mp4
done;
const Bot = function () {
this.memberVariable = 'aaa';
};
Bot.prototype.doSomething = function () {
console.log(this.memberVariable);
};
Bot.prototype.a = async function () {
// this.doSomething(); // => this.doSomething is not a function
console.log(this); // => { a_func: [Function], b_func: [Function], c_func: [Function] }
class Bot {
constructor() {
this.memberVariable = 'aaa';
}
doSomething() {
console.log(this.memberVariable); // => 'aaa'
// do somethings
}
class Bot {
constructor() {
this.memberVariable = 'aaa';
}
doSomething() {
console.log(this.memberVariable) // => undefined
// do somethings
}