Skip to content

Instantly share code, notes, and snippets.

import 'dart:math';
import 'dart:convert';
import 'package:crypto/crypto.dart';
void main(){
var rnd = new Random();
var one = rnd.nextInt(pow(2,8*4));
var two = rnd.nextInt(pow(2,8*4));
var thr = rnd.nextInt(pow(2,8*3));
List<int> onel = UTF8.encode(one.toString());
@sh4869
sh4869 / bf.rb
Last active August 29, 2015 14:04
ジンジャエールハッカーソンでの進捗
#coding:utf-8
class BrainFuck
def set(src)
@mark = 0
@source = src
@point = 0
@mem = Array.new(3000,0)
end
@sh4869
sh4869 / errorOfOauth.dart.txt
Created August 1, 2014 02:08
oauth.dart's Error message
Uncaught Error: The null object does not have a method 'expand'.
NoSuchMethodError: method not found: 'expand'
Receiver: null
Arguments: [Closure: (int) => dynamic]
Stack Trace:
#0 Object.noSuchMethod (dart:core-patch/object_patch.dart:45)
#1 oauthEncode (package:oauth/src/core.dart:29:39)
#2 Parameter.Parameter (package:oauth/src/core.dart:73:29)
#3 mapParameters.<anonymous closure> (package:oauth/src/core.dart:108:34)
@sh4869
sh4869 / ruby-build_error_message.txt
Created August 2, 2014 15:00
ruby-build error message
linking shared-object racc/cparse.so
make[2]: ディレクトリ `/tmp/ruby-build.20140802233653.31888/ruby-2.0.0-p0/ext/racc/cparse' から出ます
make[2]: ディレクトリ `/tmp/ruby-build.20140802233653.31888/ruby-2.0.0-p0/ext/readline' に入ります
compiling readline.c
linking shared-object openssl.so
readline.c: In function ‘Init_readline’:
readline.c:1886:26: error: ‘Function’ undeclared (first use in this function)
rl_pre_input_hook = (Function *)readline_pre_input_hook;
^
readline.c:1886:26: note: each undeclared identifier is reported only once for each function it appears in
@sh4869
sh4869 / QtInstallError.txt
Created August 12, 2014 08:02
Qt install error
./qt-opensource-linux-x86-5.3.1.run: error while loading shared libraries: libSM.so.6: cannot open shared object file: No such file or directory
@sh4869
sh4869 / gist:78437f4769fbbe986d5c
Created August 14, 2014 02:24
rbenv install error
ERROR: Loading command: install (LoadError)
cannot load such file -- zlib
ERROR: While executing gem ... (NameError)
uninitialized constant Gem::Commands::InstallCommand
@sh4869
sh4869 / yahoojaparse.rb
Created August 29, 2014 01:26
RubyでYahoo日本語形態解析APIを使って文章中から名詞を取り出すサンプル
require 'net/http'
require 'uri'
require 'rexml/document'
id = 'your appid'
text = '庭には二羽ニワトリがいる'
response = Net::HTTP.post_form(URI.parse('http://jlp.yahooapis.jp/MAService/V1/parse'),
{'appid'=> id,
'sentence' => text,
'results' => 'ma'})
@sh4869
sh4869 / error.txt
Created September 3, 2014 05:55
opencv compile error
test.cpp:(.text+0x6f): `cv::imread(std::string const&, int)' に対する定義されていない参照です
test.cpp:(.text+0xbf): `cv::_OutputArray::_OutputArray(cv::Mat&)' に対する定義されていない参照です
test.cpp:(.text+0xd4): `cv::_InputArray::_InputArray(cv::Mat const&)' に対する定義されていない参照です
test.cpp:(.text+0xf6): `cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)' に対する定義されていない参照です
test.cpp:(.text+0x14e): `cv::_OutputArray::_OutputArray(cv::Mat&)' に対する定義されていない参照です
test.cpp:(.text+0x166): `cv::_InputArray::_InputArray(cv::Mat const&)' に対する定義されていない参照です
test.cpp:(.text+0x193): `cv::threshold(cv::_InputArray const&, cv::_OutputArray const&, double, double, int)' に対する定義されていない参照です
test.cpp:(.text+0x1aa): `cv::_OutputArray::_OutputArray(cv::Mat&)' に対する定義されていない参照です
test.cpp:(.text+0x1c2): `cv::_InputArray::_InputArray(cv::Mat const&)' に対する定義されていない参照です
test.cpp:(.text+0x1ef): `cv::threshold(cv::_InputArray const&, cv::_OutputArray const&, double, double, int)' に対する定義されていない参照です
@sh4869
sh4869 / exmaple.dart
Created September 10, 2014 07:56
Dartで時間を文字列にするにはintlを利用する ref: http://qiita.com/sh4869/items/cc64511cec78fb208c2a
import 'package:intl/intl.dart';
import 'package:intl/date_symbol_data_local.dart';
import 'dart:core';
void main(){
var format = new DateFormat.Hms();
var dateString = format.format(new DateTime.now());
print(dataString);
}
def quicksort(nums,size):
i = 1
las = 1
if size < 2:
return
while size > i:
if nums[0] < nums[i]:
swap = nums[las]
nums[las] = nums[i]
nums[i] = swap