Skip to content

Instantly share code, notes, and snippets.

@unoemon
unoemon / after.py
Last active September 28, 2017 05:28
windows10環境でChainer2.0を動かすまでにハマった罠 ref: http://qiita.com/unoemon/items/c3289f72eae7f10422a1
def count_lines(path):
with open(path,mode='r',encoding='utf-8') as f:
return sum([1 for _ in f])
def load_vocabulary(path):
with open(path,mode='r',encoding='utf-8') as f:
# +2 for UNK and EOS
word_ids = {line.strip(): i + 2 for i, line in enumerate(f)}
word_ids['<UNK>'] = 0
@unoemon
unoemon / file0.txt
Last active September 17, 2017 04:09
AutoScaling環境においてGitを使わないでEC2を冗長化する方法 ref: http://qiita.com/unoemon/items/2301d49c1200083379d6
$ sudo yum install --enablerepo=epel lsyncd
@unoemon
unoemon / GetCookie.php
Last active September 14, 2017 07:48
LINE@に友達登録した人のアクセス元を特定(トラッキング)する方法 ref: http://qiita.com/unoemon/items/7ecaee7d578a82ca5b65
<?php
$get_id = $_COOKIE['id'];
print "君は{$get_id}のフレンズなんだね!";
@unoemon
unoemon / file0.txt
Last active October 20, 2022 03:29
Linuxでディスク容量はあるのに容量不足エラーが出る場合の対処法 ref: http://qiita.com/unoemon/items/03a49f303176ad8e4035
# ls -ld /tmp
dr-xr-xr-x. 11 root root 4096 Aug 21 04:08 /tmp
@unoemon
unoemon / MainActivity.java
Created July 29, 2017 19:38
Microsoft Azureで有名人の名前を教えてくれるアプリを作ってみた ref: http://qiita.com/unoemon/items/f3f49af7cd5c138a0fc6
private void setViews(String strResult) {
textView.setText("");
Gson gson = new Gson();
StringBuffer list = new StringBuffer();
AnalysisInDomainResult result = gson.fromJson(strResult, AnalysisInDomainResult.class);
JsonArray detectedCelebs = result.result.get(API_MODEL).getAsJsonArray();
Log.d("MaiActivity", "detectedCelebs:" + detectedCelebs.toString());
for (JsonElement element : detectedCelebs) {
JsonObject celeb = element.getAsJsonObject();
@unoemon
unoemon / MainActivity.java
Last active July 29, 2017 19:33
Microsoft Azureで有名人の名前を教えてくれるアプリを作ってみた ref: http://qiita.com/unoemon/items/b7324f4ea341965316da
private void setViews(String strResult) {
textView.setText("");
Gson gson = new Gson();
StringBuffer list = new StringBuffer();
AnalysisInDomainResult result = gson.fromJson(strResult, AnalysisInDomainResult.class);
JsonArray detectedCelebs = result.result.get(API_MODEL).getAsJsonArray();
Log.d("MaiActivity", "detectedCelebs:" + detectedCelebs.toString());
for (JsonElement element : detectedCelebs) {
JsonObject celeb = element.getAsJsonObject();