Skip to content

Instantly share code, notes, and snippets.

View martian17's full-sized avatar
🛰️
Working from home

Yutaro Yoshii martian17

🛰️
Working from home
View GitHub Profile
@martian17
martian17 / gitclone
Created February 21, 2022 09:13
Pull a git module with sub modules without ssh permissions
#!/bin/bash
# first extracting the repository name
rep_regex="\\/([^\\/]*)\\.git$"
if [[ $1 =~ $rep_regex ]]
then
reponame="${BASH_REMATCH[1]}"
else
echo "$1 doesn't match" >&2 # this could get noisy if there are a lot of non-matching files
exit
@martian17
martian17 / byte-num-to-ascii.bf
Created July 8, 2022 06:27
number decoding to ascii brainfuck
# input format
# 0 n 0 0 0 etc
# ^
# simulating input 124
>++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++
>>>+<<<
# 0 124 0 0 1
@martian17
martian17 / scrape-contacts.js
Last active October 6, 2022 13:05
scrape contacts
/*
init commands to run
$ npm init
$ npm install jsdom
$ npm install node-fetch
*/
const {JSDOM} = require("jsdom");
const fetch = (()=>{let m = import("node-fetch");return async (...args)=>await (await m).default(...args);})();
@martian17
martian17 / mandelbrot.js
Created October 7, 2022 05:10
draws rotated mandelbrot
let width = 1500;
let height = 1500;
let canvas = document.createElement("canvas");
document.body.innerHTML = "";
document.body.appendChild(canvas);
canvas.width = width;
canvas.height = height;
let ctx = canvas.getContext("2d");
let imgdata = ctx.getImageData(0,0,width,height);
const [chrome,navigator,window,document,$vars] = (()=>{
let vars = [];
let proxyMethodNames =
`apply
construct
defineProperty
deleteProperty
get
getOwnPropertyDescriptor
getPrototypeOf
@martian17
martian17 / filter.js
Created October 27, 2022 02:15
国土交通省ダウンロードフィルタリング
let inputs = [...document.querySelectorAll("table.responsive-table td input.waves-button-input")];
let arr = `01000-15.0b.zip
01000-20.0a.zip
02000-15.0b.zip
02000-20.0a.zip
03000-15.0b.zip
03000-20.0a.zip
04000-15.0b.zip
04000-20.0a.zip
05000-15.0b.zip
@martian17
martian17 / randinspect.js
Created December 23, 2022 01:15
inspect Math.random
{
let ab = new ArrayBuffer(8);
let f = new Float64Array(ab);
let ints = new Int32Array(ab);
let tally = newarr(64);
for(let i = 0; i < 100000; i++){
f[0] = Math.random();
for(let i = 31; i >= 0; i--){
tally[31-i] += ((ints[0]>>i)&1);
}
@martian17
martian17 / territorial-sweeper.mjs
Created February 1, 2023 06:24
territorial.io tool
let canvas = document.querySelector("canvas");
let ctx = canvas.getContext("2d");
let display = document.createElement("canvas");
document.body.appendChild(display);
display.style.zIndex = "1000";
display.style.position = "absolute";
display.style.bottom = "0px";
display.style.right = "0px";
display.style.pointerEvents = "none";
display.width = canvas.width/4;
@martian17
martian17 / nbt.js
Last active February 5, 2023 10:53
refactored
const TAG_End = 0;
const TAG_Byte = 1;
const TAG_Short = 2;
const TAG_Int = 3;
const TAG_Long = 4;
const TAG_Float = 5;
const TAG_Double = 6;
const TAG_Byte_Array = 7;
const TAG_String = 8;
const TAG_List = 9;
********
*<>^<>^*
* v<>v*
*<> ^ =
* ^<>v *
* v <>*
********