Skip to content

Instantly share code, notes, and snippets.

View arran4's full-sized avatar

Arran Ubels arran4

View GitHub Profile
@arran4
arran4 / main1.go
Last active January 26, 2022 08:19
package main
import (
"fmt"
)
// Library
context (
logprefix string = ""
hi
package main
import (
"fmt"
"sort"
"strings"
)
var (
ws = []float64 {
package main
import (
"fmt"
"sort"
"strings"
)
var (
ws = []float64 {
package main
import (
"github.com/fogleman/gg"
"image"
"image/color"
"image/draw"
"image/gif"
"log"
"math"
@arran4
arran4 / main.go
Created August 19, 2020 06:22
Keep on writing something like this.
package main
import (
"bytes"
"io"
"log"
"net/http"
)
type LogHandler struct {
You will have to get your cookie string.. The easiest way I have done is simply to use the chrome developer tools networking tab and turn on "preserve data" then copy the whole "cookie" section.
Don't forget to set $JOURNAL, $COOKIES
for year in 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20; do for month in 1 2 3 4 5 6 7 8 9 10 11 12; do echo "Getting $year $month"; curl -X POST 'https://www.livejournal.com/export_do.bml?authas=$JOURNAL' -d 'what=journal' -d "year=20$year" -d "month=$month" -d 'format=xml' -d 'header=Yes' -d 'encid=2' -d 'notranslation=No' -d 'field_itemid=Yes' -d 'field_eventtime=Yes' -d 'field_logtime=Yes' -d 'field_subject=Yes' -d 'field_event=Yes' -d 'field_security=Yes' -d 'field_allowmask=Yes' -d 'field_currents=Yes' --cookie $COOKIES -i > content-$year-$month.xml; done; done
package main
import (
"bytes"
"encoding/csv"
"log"
"math/rand"
"os"
"time"
)
@arran4
arran4 / main.go
Last active March 29, 2019 23:15
Use run.sh.. This will show that underline conditions will cause err, and the errors will be low level. (Well a lower level than the fmt package, OS level.)
package main
import (
"fmt"
"log"
"time"
)
func main() {
log.SetFlags(log.Flags()|log.Lshortfile)
function createTimesheet(id, date, m, tu, w, th, f, mode) {
if (id != "") {
return id;
}
var dateStr = Utilities.formatDate(date, "Australia/Melbourne", "yyyy-MM-dd");
var timesheetTemplateId = <Document ID here>;
var prefix = "";
if (mode == "test") {
prefix = "Test ";
}