tweak: Found some bugs, added some convenience options
This commit is contained in:
parent
ee0ee3ca16
commit
62b0f8e210
2555
data/astralcodexten-questions.json
Normal file
2555
data/astralcodexten-questions.json
Normal file
File diff suppressed because it is too large
Load Diff
|
@ -6,7 +6,8 @@
|
|||
"scripts": {
|
||||
"start": "node src/index.js",
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"reload": "heroku run:detached node src/utils/doEverythingForScheduler.js"
|
||||
"reload": "heroku run:detached node src/utils/doEverythingForScheduler.js",
|
||||
"setCookies": "./src/utils/setCookies.sh"
|
||||
|
||||
},
|
||||
"repository": {
|
||||
|
|
|
@ -91,9 +91,11 @@ export async function astralcodexten(){
|
|||
results.push(result)
|
||||
})
|
||||
}
|
||||
// let string = JSON.stringify(results, null, 2)
|
||||
// fs.writeFileSync('./data/foretold-questions.json', string);
|
||||
// console.log(JSON.stringify(results, null, 2))
|
||||
/*
|
||||
let string = JSON.stringify(results, null, 2)
|
||||
console.log(JSON.stringify(results, null, 2))
|
||||
fs.writeFileSync('./data/astralcodexten-questions.json', string);
|
||||
*/
|
||||
await upsert(results, "astralcodexten-questions")
|
||||
// console.log(results)
|
||||
console.log("Done")
|
||||
|
|
|
@ -147,7 +147,7 @@ export async function metaculus() {
|
|||
}
|
||||
|
||||
// let string = JSON.stringify(all_questions, null, 2)
|
||||
fs.writeFileSync('./metaculus-questions.json', string);
|
||||
// fs.writeFileSync('./metaculus-questions.json', string);
|
||||
await upsert(all_questions, "metaculus-questions")
|
||||
|
||||
console.log("Done")
|
||||
|
|
63
src/utils/setCookies.sh
Executable file
63
src/utils/setCookies.sh
Executable file
|
@ -0,0 +1,63 @@
|
|||
#!/usr/bin/bash
|
||||
clear
|
||||
echo "
|
||||
Platforms:
|
||||
[0]: CSET-Foretell
|
||||
[1]: Good Judgment Open
|
||||
"
|
||||
read -p "Choose a platform [0/1]: " platform
|
||||
echo ""
|
||||
case $platform in
|
||||
"0" )
|
||||
echo "Platform: CSET-Foretell"
|
||||
echo "Copy request headers from https://www.cset-foretell.com/questions"
|
||||
firefox "https://www.cset-foretell.com/questions"
|
||||
echo "Copy the request headers to clipboard"
|
||||
read -p "Press any key when copied: " copied
|
||||
cookie=$(xclip -selection c -o | {
|
||||
while IFS= read -r line; do
|
||||
if [[ "$line" == *"Cookie:"* ]]; then
|
||||
#echo "Found cookie!"
|
||||
# echo "$line"
|
||||
cookie="$(echo $line |sed 's|Cookie: ||' )"
|
||||
#echo "Cookie: $cookie"
|
||||
fi
|
||||
done
|
||||
echo "$cookie"
|
||||
}
|
||||
)
|
||||
## Has to deal with https://unix.stackexchange.com/questions/9954/why-is-my-variable-local-in-one-while-read-loop-but-not-in-another-seemingly
|
||||
echo ""
|
||||
echo "Cookie found:"
|
||||
echo "$cookie"
|
||||
echo "Running: heroku config:set CSETFORETELL_COOKIE='\$cookie'"
|
||||
heroku config:set CSETFORETELL_COOKIE="$cookie"
|
||||
;;
|
||||
"1" )
|
||||
echo "Platform: Good Judgment Open"
|
||||
echo "Copy request headers from https://www.gjopen.com/questions/"
|
||||
firefox "https://www.gjopen.com/questions/"
|
||||
echo "Copy the request headers to clipboard"
|
||||
read -p "Press any key when copied: " copied
|
||||
cookie=$(xclip -selection c -o | {
|
||||
while IFS= read -r line; do
|
||||
if [[ "$line" == *"Cookie:"* ]]; then
|
||||
#echo "Found cookie!"
|
||||
# echo "$line"
|
||||
cookie="$(echo $line |sed 's|Cookie: ||' )"
|
||||
#echo "Cookie: $cookie"
|
||||
fi
|
||||
done
|
||||
echo "$cookie"
|
||||
}
|
||||
)
|
||||
echo ""
|
||||
echo "Cookie found:"
|
||||
echo "$cookie"
|
||||
echo "Running: heroku config:set GOODJUDGMENTOPENCOOKIE='\$cookie'"
|
||||
heroku config:set GOODJUDGMENTOPENCOOKIE="$cookie"
|
||||
;;
|
||||
* )
|
||||
echo "Option not in {0,1}, exiting."
|
||||
;;
|
||||
esac
|
Loading…
Reference in New Issue
Block a user