This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* GPS距離から住所を特定するexploit | |
* 作成: javascripter | |
* 3点から座標を割り出す手法のアドバイス: qnighy | |
*/ | |
// メッセージ表示の際に呼ばれるaddChatLog関数をフックする | |
var _addChatLog = addChatLog; | |
addChatLog = function (kind, msg) { | |
if (kind == 4) { // 距離通知のメッセージ | |
var distance = msg.match(/(\d+)/); // km単位での距離 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
/* http://d.hatena.ne.jp/Cherenkov/20100827/p1 のビット演算的解法 */ | |
typedef unsigned char uchar; | |
void putbits(uchar n) { /* 二進表現で出力 */ | |
uchar i; | |
for (i = 128; i; i >>= 1) { | |
putchar(n & i ? '1' : '0'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(void) { | |
int x, y; | |
for (x = 1; x <= 5; x++) { | |
for (y = 1; y <= 5; y++) { | |
printf("%d x %d = %d\n", x, y, x * y); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
long long int isqrt(long long int n) { | |
int i; | |
for (i = 1; n > 0; i++) { | |
n -= i * 2 + 1; | |
} | |
return i - 1; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
/* Project Euler - Problem 1 */ | |
int prob() { | |
int i; | |
int total = 0; | |
for (i = 1; i < 1000; i++) { | |
if (i % 3 == 0 || | |
i % 5 == 0) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'generator' | |
fibs = Generator.new {|g| | |
a = 0 | |
b = 1 | |
loop { | |
g.yield a | |
a, b = b, a + b | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function.prototype.curried = function (that) { | |
var f = this, value; | |
var T = function () { | |
value = f.apply(that, arguments); | |
return T; | |
}; | |
T.valueOf = function () { | |
return value; | |
}; | |
return T; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ValueFinder() { | |
} | |
ValueFinder.NotFoundError = function () { | |
Error.apply(this, arguments); | |
}; | |
ValueFinder.NotFoundError.prototype = new Error(); | |
ValueFinder.prototype.find = function (array) { | |
if (array.length == 0) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Object.defineProperties(Object, { | |
seal: { | |
configurable: true, | |
enumerable: false, | |
value: function (object) { | |
var properties = Object.getOwnPropertyNames(object); | |
properties.forEach(function (name) { | |
var desc = Object.getOwnPropertyDescriptor(object, name); | |
desc.configurable = false; | |
Object.defineProperty(object, name, desc); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var srand, rand; | |
(function () { | |
const a = 16807, b = 0, m = 2147483647; | |
var x = 1; | |
srand = function (seed) { | |
x = seed; | |
}; | |
rand = function () { | |
x = (a * x + b) % m; |