Skip to content

Instantly share code, notes, and snippets.

View javascripter's full-sized avatar

javascripter

View GitHub Profile
@javascripter
javascripter / gps_exploit.js
Last active August 19, 2021 12:36
ChatPadでGPS距離から住所を特定するexploit(修正済み)
/* GPS距離から住所を特定するexploit
* 作成: javascripter
* 3点から座標を割り出す手法のアドバイス: qnighy
*/
// メッセージ表示の際に呼ばれるaddChatLog関数をフックする
var _addChatLog = addChatLog;
addChatLog = function (kind, msg) {
if (kind == 4) { // 距離通知のメッセージ
var distance = msg.match(/(\d+)/); // km単位での距離
#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');
#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);
}
}
#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;
}
#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) {
require 'generator'
fibs = Generator.new {|g|
a = 0
b = 1
loop {
g.yield a
a, b = b, a + b
}
}
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;
function ValueFinder() {
}
ValueFinder.NotFoundError = function () {
Error.apply(this, arguments);
};
ValueFinder.NotFoundError.prototype = new Error();
ValueFinder.prototype.find = function (array) {
if (array.length == 0) {
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);
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;