luajit does support hashbangs
This commit is contained in:
parent
fad5da2e27
commit
0582895825
2
clean
2
clean
@ -4,5 +4,5 @@ part="$2"
|
||||
|
||||
day="$(printf '%02d' "$day")"
|
||||
|
||||
rm -f ./run ./luac.out
|
||||
rm -f ./run
|
||||
rm -f "day${1}/part${2}.hi" "day${1}/part${2}.o"
|
||||
|
2
day00/part1.lua
Normal file → Executable file
2
day00/part1.lua
Normal file → Executable file
@ -1,3 +1,5 @@
|
||||
#!/usr/bin/env luajit
|
||||
|
||||
io.input(arg[3])
|
||||
local min, max = math.huge, -math.huge
|
||||
for i = 1, io.read("*n") do
|
||||
|
2
day01/part1.lua
Normal file → Executable file
2
day01/part1.lua
Normal file → Executable file
@ -1,3 +1,5 @@
|
||||
#!/usr/bin/env luajit
|
||||
|
||||
local count = 0
|
||||
local previous
|
||||
for number in io.lines(arg[3]) do
|
||||
|
2
day01/part2.lua
Normal file → Executable file
2
day01/part2.lua
Normal file → Executable file
@ -1,3 +1,5 @@
|
||||
#!/usr/bin/env luajit
|
||||
|
||||
local count = 0
|
||||
local a, b, c
|
||||
for line in io.lines(arg[3]) do
|
||||
|
2
day02/part1.lua
Normal file → Executable file
2
day02/part1.lua
Normal file → Executable file
@ -1,3 +1,5 @@
|
||||
#!/usr/bin/env luajit
|
||||
|
||||
local position, depth = 0, 0
|
||||
for line in io.lines(arg[3]) do
|
||||
local split = line:find(" ")
|
||||
|
2
day02/part2.lua
Normal file → Executable file
2
day02/part2.lua
Normal file → Executable file
@ -1,3 +1,5 @@
|
||||
#!/usr/bin/env luajit
|
||||
|
||||
local position, depth, aim = 0, 0, 0
|
||||
for line in io.lines(arg[3]) do
|
||||
local split = line:find(" ")
|
||||
|
2
day03/part1.lua
Normal file → Executable file
2
day03/part1.lua
Normal file → Executable file
@ -1,3 +1,5 @@
|
||||
#!/usr/bin/env luajit
|
||||
|
||||
local ZERO = string.byte("0", 1)
|
||||
local ONE = string.byte("1", 1)
|
||||
local total = 0
|
||||
|
2
day03/part2.lua
Normal file → Executable file
2
day03/part2.lua
Normal file → Executable file
@ -1,3 +1,5 @@
|
||||
#!/usr/bin/env luajit
|
||||
|
||||
local ZERO = string.byte("0", 1)
|
||||
local ONE = string.byte("1", 1)
|
||||
local lines = {}
|
||||
|
2
day04/part1.lua
Normal file → Executable file
2
day04/part1.lua
Normal file → Executable file
@ -1,3 +1,5 @@
|
||||
#!/usr/bin/env luajit
|
||||
|
||||
function split(text, sep)
|
||||
local parts = {}
|
||||
local start = 0
|
||||
|
1
day04/part2.lua
Normal file → Executable file
1
day04/part2.lua
Normal file → Executable file
@ -1,3 +1,4 @@
|
||||
#!/usr/bin/env luajit
|
||||
require("utils")
|
||||
|
||||
local f = io.open(arg[3])
|
||||
|
2
day05/part1.lua
Normal file → Executable file
2
day05/part1.lua
Normal file → Executable file
@ -1,3 +1,5 @@
|
||||
#!/usr/bin/env luajit
|
||||
|
||||
function readline()
|
||||
local x1 = io.read("*n")
|
||||
io.read(1) -- ","
|
||||
|
1
day05/part2.lua
Normal file → Executable file
1
day05/part2.lua
Normal file → Executable file
@ -1,3 +1,4 @@
|
||||
#!/usr/bin/env luajit
|
||||
require("utils")
|
||||
|
||||
function readline()
|
||||
|
3
prepare
3
prepare
@ -5,7 +5,8 @@ part="$2"
|
||||
day="$(printf '%02d' "$day")"
|
||||
|
||||
if test -f "day${day}/part${part}.lua"; then
|
||||
luajit -v >/dev/null
|
||||
/usr/bin/env luajit -v >/dev/null
|
||||
cp "day${day}/part${part}.lua" run
|
||||
elif test -f "day${day}/part${part}.hs"; then
|
||||
#stack build
|
||||
stack ghc -- -O3 "day${day}/part${part}.hs" -o run
|
||||
|
Loading…
Reference in New Issue
Block a user