-
Notifications
You must be signed in to change notification settings - Fork 9
/
func
69 lines (53 loc) · 1.13 KB
/
func
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env bash
function rf() {
local CODE
CODE="print(${1})"
riff -e "$CODE"
}
# Print Lua disassembly of provided code
function luad() {
local CODE
CODE=$1
echo $1 | luac -l -
}
# Print a single Lua expression
function luap() {
local CODE
CODE="print(${1})"
lua -e "$CODE"
}
# Print mawk disassembly of provided code
function mawkd() {
local CODE
CODE="BEGIN{${1}}"
mawk -W dump "$CODE"
}
# Print a single AWK expression, using mawk
function mawkp() {
local CODE
CODE="BEGIN{print ${1}}"
mawk "$CODE"
}
# Print a single Perl expression
function perlp() {
local CODE
CODE="print(${1})"
perl -le "$CODE"
}
# Print a single Python expression
function pyp() {
local CODE
CODE="print(${1})"
python3 -c "$CODE"
}
# Print a single Ruby expression
function rubyp() {
local CODE
CODE="puts ${1}"
ruby -e "$CODE"
}
function aocinput() {
local YEAR=$(pwd | awk -F/ '{printf "%s\n", $(NF-1)}')
local DAY=$(pwd | awk -F/ '{printf "%d\n", $(NF)}')
curl --cookie session=$AOC_COOKIE https://adventofcode.com/20$YEAR/day/$DAY/input > input
}