all repos — dotfiles @ 3038ed1044c49e77336c33ca2f61da7177aaaad3

linux dotfiles

bin/misc/update_gist (view raw)

 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
#!/bin/sh

if [ "$1" ]
then
cat "$1" | sed ':a;N;$!ba;s/\n/\\n/g' | sed 's/"/\\"/g' > content

cat <<EOF > payload
{
  "description": "REST API docs for LMM Counsellor App",
  "files": {
    "REST API Counsellor.md": {
      "content": "`cat content`",
      "filename": "REST API Counsellor.md"
    }
  }
}
EOF

curl -s -X PATCH\
    -H 'Authorization: token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'\
    -d@payload\
    https://api.github.com/gists/c1b86bac8046770f8718d60e120f92ea > /dev/null 2>&1

rm payload content
fi