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
javarun() { | |
if [ -z "$1" ]; then | |
echo "usage: javarun Triangle" | |
return | |
fi | |
local bar="\n------------------------------------\n" | |
echo -e $bar | |
mkdir -p output | |
local c="javac -d output $1.java $HOME/Turtle.java" | |
echo -e "$c:\n" |
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
"use strict"; | |
let variable_names = []; | |
function tokenize(s) { | |
function isNextToken(s, i, t) { | |
for (let j = 0; j < t.length; j++) { | |
if (s.substr(i, t[j].length) == t[j]) { | |
return j; |
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
#!/usr/bin/rdmd | |
// 自然数を返す無限レンジ。 | |
// map等の関数を使うためにはinputrangeである必要があり、 | |
// inputrangeの条件を満たすためには | |
// front,popFront,emptyという3つの関数を実装する必要がある | |
struct NaturalNumber | |
{ | |
long n = 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
stack and heap in brainfuck | |
result: 7 5 0 3 1 7 | |
b1 == 5 | |
b2 == 7 | |
stack == [3 7] | |
>> allocate 2 | |
>+++ push 3 | |
push 5 | |
>+ |
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
/* | |
$ rdmd tree.d | |
insert/print [i,p]: i | |
value: 2 | |
2 inserted. current version: 1 | |
insert/print [i,p]: i | |
value: 6 | |
6 inserted. current version: 2 | |
insert/print [i,p]: i | |
value: 3 |
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> | |
#include <stdlib.h> | |
#include <time.h> | |
#include <stdint.h> | |
typedef struct stack_element | |
{ | |
int64_t *ptr; | |
size_t length; | |
int8_t state; |
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
import std.stdio : writefln, writef; | |
import std.format : format; | |
import std.conv : to; | |
void main(string[] args) | |
{ | |
long L = args[1].to!long(); | |
auto fmt = format!"%%0%db"(L); | |
outer: foreach (c_bitmask; 1 .. (1 << (1 << L))) |
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
import std; | |
void main(string[] args) | |
{ | |
if (args.length < 3) | |
{ | |
writeln("Usage: rdmd cyclic_code.d <符号長> <生成多項式>"); | |
writeln("example: rdmd cyclic_code.d 7 1011"); | |
return; | |
} |
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
fahslots() { | |
local FAH_SID=`curl -s http://localhost:7396/js/main.js | head -n1 | awk -F\' '{print $2}'` | |
watch -t curl -s "http://localhost:7396/api/slots?sid=$FAH_SID" | |
} |
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
fahdescription() { | |
curl -s -G https://api.foldingathome.org/project/$1 | jq -r .cause | |
echo | |
html2text --ignore-links <(curl -s -G https://api.foldingathome.org/project/$1 | jq -r .mdescription) | |
} |