Skip to content

Commit

Permalink
add 4chan support
Browse files Browse the repository at this point in the history
commit 660503d
Author: azimut <azimut.github@protonmail.com>
Date:   Thu Apr 20 02:56:25 2023 -0300

    fix: parse multi reply with same message for all

commit 0c290f9
Author: azimut <azimut.github@protonmail.com>
Date:   Wed Apr 19 23:51:45 2023 -0300

    goreleaser add fourchan

commit 174597f
Author: azimut <azimut.github@protonmail.com>
Date:   Wed Apr 19 23:38:38 2023 -0300

    minor TODO

commit 4e9dcc2
Author: azimut <azimut.github@protonmail.com>
Date:   Wed Apr 19 22:55:07 2023 -0300

    fix: range bug on .find() for nested replies

commit 3356a8c
Author: azimut <azimut.github@protonmail.com>
Date:   Wed Apr 19 20:57:39 2023 -0300

    minor always print filename

commit 427d7a6
Author: azimut <azimut.github@protonmail.com>
Date:   Wed Apr 19 20:28:37 2023 -0300

    minor: formatting, add go-4chan-api bug description

commit e299e9e
Author: azimut <azimut.github@protonmail.com>
Date:   Wed Apr 19 12:47:23 2023 -0300

    added wrapping of comments and greentext

commit c952509
Author: azimut <azimut.github@protonmail.com>
Date:   Wed Apr 19 11:00:49 2023 -0300

    fix send clean unique comment, test cleanComment()

commit 26c709d
Author: azimut <azimut.github@protonmail.com>
Date:   Wed Apr 19 09:26:18 2023 -0300

    minor: clean comments of <br> on the sides and all of <wbr>

commit 7dca443
Author: azimut <azimut.github@protonmail.com>
Date:   Wed Apr 19 08:21:23 2023 -0300

    fix: add support for empty reply messages

commit 70c36d4
Author: azimut <azimut.github@protonmail.com>
Date:   Wed Apr 19 06:56:26 2023 -0300

    test: add id's to test, for easier conditional breakpoints

commit 143076e
Author: azimut <azimut.github@protonmail.com>
Date:   Wed Apr 19 06:35:37 2023 -0300

    tests: add specific tests explodePost

commit fc8b36d
Author: azimut <azimut.github@protonmail.com>
Date:   Wed Apr 19 04:15:35 2023 -0300

    minor: fix printing format of comments

commit 2015f60
Author: azimut <azimut.github@protonmail.com>
Date:   Wed Apr 19 03:53:48 2023 -0300

    reQuote extend to optionally capture " <br>" at the end

commit 1a8b22a
Author: azimut <azimut.github@protonmail.com>
Date:   Wed Apr 19 03:19:41 2023 -0300

    fixed not nestings issue, add DEBUG on makefile to disable -ldflags

    apparently kind of obvious, but not evident when looking at the
    code (?

    but when you have do a for-range loop your elements are NOT pointers
    they are copies

    for _, post := range thread.posts // post is Post not *Post

    so if you use that *post* reference it will be lost on the stack
    instead, directly index

    for i := range thread.posts

    and use thread.posts[i]

commit d099c1e
Author: azimut <azimut.github@protonmail.com>
Date:   Wed Apr 19 00:40:16 2023 -0300

    debugging post.replies insertion

commit 8b23614
Author: azimut <azimut.github@protonmail.com>
Date:   Tue Apr 18 11:28:30 2023 -0300

    fix makefile + .gitignore bins + fourchan graph mostly complete

    missing add depth field and other formatting of messages

commit b3c1058
Author: azimut <azimut.github@protonmail.com>
Date:   Fri Apr 14 20:08:39 2023 -0300

    update todos... add codeblock and embed

commit abf0841
Author: azimut <azimut.github@protonmail.com>
Date:   Fri Apr 14 04:24:20 2023 -0300

    update todo...

commit 663d711
Author: azimut <azimut.github@protonmail.com>
Date:   Thu Apr 13 02:33:08 2023 -0300

    add TODO notes

commit 7d3608b
Author: azimut <azimut.github@protonmail.com>
Date:   Thu Apr 13 02:32:33 2023 -0300

    fix: skip post 0 from go-4chan-api, minor rename

commit bdb3bdd
Author: azimut <azimut.github@protonmail.com>
Date:   Thu Apr 13 00:30:01 2023 -0300

    initial 4chan parsing and structs

    needs more parsing for
    - comment tree generation
    - and html parsing
    - absolute links fixing
    - relative links fixing
      - for external messages (not in the thread)
      - for internal messages (in the thread)
        - probably only use them for the tree generation
  • Loading branch information
azimut committed Apr 20, 2023
1 parent bcdf45d commit 2a5dce0
Show file tree
Hide file tree
Showing 16 changed files with 949 additions and 20 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
twitterview
hackerview
redditview
fourchanview

# Created by https://www.toptal.com/developers/gitignore/api/go
# Edit at https://www.toptal.com/developers/gitignore?templates=go
Expand Down
7 changes: 7 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,10 @@ builds:
goos: [ linux ]
goarch: [ amd64 ]
ldflags: [ "-s -w" ]

- id: fourchanview
binary: fourchanview
main: ./cmd/fourchanview
goos: [ linux ]
goarch: [ amd64 ]
ldflags: [ "-s -w" ]
22 changes: 12 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
GO_FILES = $(shell find . -type f -name '*.go')
GO_FILES := $(shell find . -type f -name '*.go')
BINARIES := twitterview hackerview redditview fourchanview
LDFLAGS := -ldflags="-s -w"

ifdef DEBUG
undefine LDFLAGS
endif

.PHONY: all install clean test

all: twitterview hackerview redditview
all: $(BINARIES)

hackerview:
redditview:
twitterview: $(GO_FILES)
go build -v -ldflags="-s -w" ./cmd/$@
$(BINARIES): $(GO_FILES)
go build -v $(LDFLAGS) ./cmd/$@
ls -lh $@

install: hackerview twitterview redditview
mv hackerview $(HOME)/go/bin/
mv twitterview $(HOME)/go/bin/
mv redditview $(HOME)/go/bin/
install: $(BINARIES);
mv $(BINARIES) $(HOME)/go/bin/

clean: ; go clean -x ./...
test: ; go test -vet=all -v -race ./...
57 changes: 57 additions & 0 deletions cmd/fourchanview/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package main

import (
"errors"
"flag"
"fmt"
"io"
"log"
"os"
"time"

"github.com/azimut/cli-view/internal/fourchan"
"github.com/fatih/color"
)

type options struct {
timeout time.Duration
useColors bool
userAgent string
width int
}

var opts options

func init() {
flag.BoolVar(&opts.useColors, "C", true, "use colors")
flag.IntVar(&opts.width, "w", 80, "fixed with") // TODO: use opts.width
}

func usage() {
fmt.Printf("Usage: %s [OPTIONS] URL ...\n", os.Args[0])
flag.PrintDefaults()
}

func run(args []string, stdout io.Writer) error {
flag.Parse()
flag.Usage = usage
color.NoColor = !opts.useColors
if flag.NArg() != 1 {
flag.Usage()
return errors.New("missing URL argument")
}
url := flag.Args()[0]
thread, err := fourchan.Fetch(url)
if err != nil {
return err
}
fmt.Println(thread)
return nil
}

func main() {
err := run(os.Args, os.Stdout)
if err != nil {
log.Fatal(err)
}
}
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ require (
github.com/fatih/color v1.15.0
github.com/gomarkdown/markdown v0.0.0-20230322041520-c84983bdbf2a
github.com/jaytaylor/html2text v0.0.0-20230321000545-74c2419ad056
github.com/moshee/go-4chan-api v0.0.0-20180705201006-117c90c93e9c
github.com/tidwall/gjson v1.14.4
)

require (
github.com/alecthomas/chroma v0.7.1 // indirect
github.com/alecthomas/chroma v0.10.0 // indirect
github.com/andybalholm/cascadia v1.3.1 // indirect
github.com/aymanbagabas/go-osc52 v1.2.1 // indirect
github.com/charmbracelet/lipgloss v0.6.0 // indirect
github.com/containerd/console v1.0.3 // indirect
github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 // indirect
github.com/disintegration/imaging v1.6.2 // indirect
github.com/dlclark/regexp2 v1.1.6 // indirect
github.com/dlclark/regexp2 v1.4.0 // indirect
github.com/eliukblau/pixterm/pkg/ansimage v0.0.0-20191210081756-9fb6cf8c2f75 // indirect
github.com/kyokomi/emoji/v2 v2.2.8 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
Expand Down
13 changes: 6 additions & 7 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@ github.com/Necoro/html2text v0.0.0-20200510210923-a6c1c021f31e h1:1IOaYE0neHR8pt
github.com/Necoro/html2text v0.0.0-20200510210923-a6c1c021f31e/go.mod h1:D5SSrHqldK3oe5lx1uMRgJzbpykn5I/9C/sctGqCDHU=
github.com/PuerkitoBio/goquery v1.8.1 h1:uQxhNlArOIdbrH1tr0UXwdVFgDcZDrZVdcpygAcwmWM=
github.com/PuerkitoBio/goquery v1.8.1/go.mod h1:Q8ICL1kNUJ2sXGoAhPGUdYDJvgQgHzJsnnd3H7Ho5jQ=
github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38 h1:smF2tmSOzy2Mm+0dGI2AIUHY+w0BUc+4tn40djz7+6U=
github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38/go.mod h1:r7bzyVFMNntcxPZXK3/+KdruV1H5KSlyVY0gc+NgInI=
github.com/alecthomas/chroma v0.7.1 h1:G1i02OhUbRi2nJxcNkwJaY/J1gHXj9tt72qN6ZouLFQ=
github.com/alecthomas/chroma v0.7.1/go.mod h1:gHw09mkX1Qp80JlYbmN9L3+4R5o6DJJ3GRShh+AICNc=
github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721 h1:JHZL0hZKJ1VENNfmXvHbgYlbUOvpzYzvy2aZU5gXVeo=
github.com/alecthomas/chroma v0.10.0 h1:7XDcGkCQopCNKjZHfYrNLraA+M7e0fMiJ/Mfikbfjek=
github.com/alecthomas/chroma v0.10.0/go.mod h1:jtJATyUxlIORhUOFNA9NZDWGAQ8wpxQQqNSB4rjA/1s=
github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721/go.mod h1:QO9JBoKquHd+jz9nshCh40fOfO+JzsoXy8qTHF68zU0=
github.com/alecthomas/kong v0.2.1-0.20190708041108-0548c6b1afae/go.mod h1:+inYUSluD+p4L8KdviBSgzcqEjUQOfC5fQDRFuc36lI=
github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897 h1:p9Sln00KOTlrYkxI1zYWl1QLnEqAqEARBEYa8FQnQcY=
github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ=
github.com/andybalholm/cascadia v1.3.1 h1:nhxRkql1kdYCc8Snf7D5/D3spOX+dBgjA6u8x004T2c=
github.com/andybalholm/cascadia v1.3.1/go.mod h1:R4bJ1UQfqADjvDa4P6HZHLh/3OxWWEqc0Sk8XGwHqvA=
Expand All @@ -33,15 +31,15 @@ github.com/charmbracelet/lipgloss v0.6.0 h1:1StyZB9vBSOyuZxQUcUwGr17JmojPNm87ini
github.com/charmbracelet/lipgloss v0.6.0/go.mod h1:tHh2wr34xcHjC2HCXIlGSG1jaDF0S0atAUvBMP6Ppuk=
github.com/containerd/console v1.0.3 h1:lIr7SlA5PxZyMV30bDW0MGbiOPXwc63yRuCP0ARubLw=
github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U=
github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 h1:y5HC9v93H5EPKqaS1UYVg1uYah5Xf51mBfIoWehClUQ=
github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964/go.mod h1:Xd9hchkHSWYkEqJwUGisez3G1QY8Ryz0sdWrLPMGjLk=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/disintegration/imaging v1.6.2 h1:w1LecBlG2Lnp8B3jk5zSuNqd7b4DXhcjwek1ei82L+c=
github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4=
github.com/dlclark/regexp2 v1.1.6 h1:CqB4MjHw0MFCDj+PHHjiESmHX+N7t0tJzKvC6M97BRg=
github.com/dlclark/regexp2 v1.1.6/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
github.com/dlclark/regexp2 v1.4.0 h1:F1rxgk7p4uKjwIQxBs9oAXe5CqrXlCduYEJvrF4u93E=
github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
github.com/eliukblau/pixterm/pkg/ansimage v0.0.0-20191210081756-9fb6cf8c2f75 h1:vbix8DDQ/rfatfFr/8cf/sJfIL69i4BcZfjrVOxsMqk=
Expand Down Expand Up @@ -78,6 +76,8 @@ github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh
github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU=
github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/moshee/go-4chan-api v0.0.0-20180705201006-117c90c93e9c h1:ZCwgcba0vDWSBPGENfZrajUTYRlhZTTxeDLvod+UObI=
github.com/moshee/go-4chan-api v0.0.0-20180705201006-117c90c93e9c/go.mod h1:mGS3UGLG5GY9T5oYiVZ9Y30VhZxBTmOT0OLeWpScvsI=
github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b h1:1XF24mVaiu7u+CFywTdcDo2ie1pzzhwjt6RHqzpMU34=
github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b/go.mod h1:fQuZ0gauxyBcmsdE3ZT4NasjaRdxmbCS0jRHsrWu3Ho=
github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA=
Expand All @@ -98,7 +98,6 @@ github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJ
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/sahilm/fuzzy v0.1.0/go.mod h1:VFvziUEIMCrT6A6tw2RFIXPXXmzXbOsSHF0DOI8ZK9Y=
github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf h1:pvbZ0lM0XWPBqUKqFU8cmavspvIl9nulOYwdy6IFRRo=
github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf/go.mod h1:RJID2RhlZKId02nZ62WenDCkgHFerpIOmW0iT7GKmXM=
Expand Down
156 changes: 156 additions & 0 deletions internal/fourchan/TODO.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
- TUI: Add link to comment. So people can CAPTCHA and reply there.
- go-4chan-api bug: parsing this json post, will return a Post with an *nil* File
#+begin_src json
{
"com": "sveltecomrades...",
"ext": ".png",
"filename": "",
"fsize": 771586,
"h": 1486,
"md5": "yABXo4At8BsykjrRXWe3BA==",
"name": "Anonymous",
"no": 92882383,
"now": "04/18/23(Tue)20:14:20",
"resto": 92881288,
"tim": 1681863260820065,
"time": 1681863260,
"tn_h": 79,
"tn_w": 125,
"w": 2346,
}
#+end_src
- Types of messages
- [ ] Mentioning another post in the middle of the respons
#+begin_src html
<a href="#p92877538" class="quotelink">&gt;&gt;92877538</a><br>
<span class="quote">&gt;Multi-threaded GREP implementation.</span><br>
how would that work?<br>
<span class="quote">&gt;Language virtual machine</span><br>
what does that mean?<br>
<span class="quote">&gt;Daemonized calculator</span><br>
cringe<br>
<span class="quote">&gt;General Lambert&#039;s-Problem Solver</span><br>
cringe, see <a href="#p92892503" class="quotelink">&gt;&gt;92892503</a> and stop sucking dicks
#+end_src
#+begin_src html
<a href="#p92877538" class="quotelink">&gt;&gt;92877538</a><br><span class="quote">&gt;Multi-threaded GREP implementation.</span><br>how would that work?<br><span class="quote">&gt;Language virtual machine</span><br>what does that mean?<br><span class="quote">&gt;Daemonized calculator</span><br>cringe<br><span class="quote">&gt;General Lambert&#039;s-Problem Solver</span><br>cringe, see <a href="#p92892503" class="quotelink">&gt;&gt;92892503</a> and stop sucking dicks
#+end_src
#+begin_src
>>92877538
>Multi-threaded GREP implementation.
how would that work?
>Language virtual machine
what does that mean?
>Daemonized calculator
cringe
>General Lambert's-Problem Solver
cringe, see >>92892503 and stop sucking dicks
#+end_src
- [ ] Code embed *<pre class=prettyprint"*, could be inlined
#+begin_src html
<a href=\"#p92788773\" class=\"quotelink\">&gt;&gt;92788773</a><br>
<span class=\"quote\">&gt;In the first one, you&#039;re passing i a dictionary that matches the keyword arguments of the function, so it works.</span><br>
I see, thank you anon.<br>
But....aren&#039;t function arguments when declaring it just random words that do not need to fit the names of the variables/objects that will use it?<br>
Like, this works:<br>
<br>
<pre class=\"prettyprint\">a=&#039;hello world&#039;<br>
<br>
def fun(qqq):<br>
print(qqq)<br>
<br>
fun(a)<br>
</pre><br>
<br>
It did not matter if i write the argument of the function <pre class=\"prettyprint\">def fun(lollmao)</pre>, it can take any variable in it even if it&#039;s not called &quot;lollmao&quot;, how come now the args need to fit 100% the name of the keys in the dictionary unpacked?
#+end_src
#+begin_src
>>92788773
>In the first one, you're passing i a dictionary that matches the keyword arguments of the function, so it works.
I see, thank you anon.
But....aren't function arguments when declaring it just random words that do not need to fit the names of the variables/objects that will use it?
Like, this works:

a='hello world'

def fun(qqq):
print(qqq)

fun(a)



It did not matter if i write the argument of the function

def fun(lollmao)

, it can take any variable in it even if it's not called "lollmao", how come now the args need to fit 100% the name of the keys in the dictionary unpacked?
#+end_src
- [ ] YT Embed (I ADDED NEW LINE AFTER BR)
#+begin_src html
<a href=\"#p92787439\" class=\"quotelink\">&gt;&gt;92787439</a><br>
<span class=\"quote\">&gt;I like watching Unix history videos</span><br>
here&#039;s a good one<br>
https://www.youtube.com/watch?v=tc4<wbr>ROCJYbm0
#+end_src
#+begin_src
>>92787439
>I like watching Unix history videos
here's a good one
https://www.youtube.com/watch?v=tc4ROCJYbm0 [Embed]
#+end_src
- [X] > Green text (missing <br>?)
<span class="quote">&gt;move over im gonna make the thread</span>
- [ ] Link to Message on the same Thread
>>92748359
<a href="#p92748359" class="quotelink">&gt;&gt;92748359</a><br>
- [ ] Multi-quote on the same Thread, with the same message (I ADDED THE NEW LINES AFTER br)
#+begin_src html
<a href=\"#p92772863\" class=\"quotelink\">&gt;&gt;92772863</a><br>
<a href=\"#p92773151\" class=\"quotelink\">&gt;&gt;92773151</a><br>
<a href=\"#p92773243\" class=\"quotelink\">&gt;&gt;92773243</a><br>
<a href=\"#p92773269\" class=\"quotelink\">&gt;&gt;92773269</a><br>
<a href=\"#p92773469\" class=\"quotelink\">&gt;&gt;92773469</a><br>
is it true about gcc?<br>
https://www.youtube.com/watch?v=B5Y<wbr>okNW7tIs
#+end_src
- [ ] Multi-quote to messages on other Thread (I ADDED THE NEW LINES AFTER br)
#+begin_src html
<a href=\"/g/thread/92750475#p92762320\" class=\"quotelink\">&gt;&gt;92762320</a><br>
I have a macro that typedef&#039;s up to 2 levels of pointers. If I ever need more, then I can modify the macro and everything will now have the extra typedefs applied. (pic related)<br>
<a href=\"/g/thread/92750475#p92762569\" class=\"quotelink\">&gt;&gt;92762569</a><br>
Nope. Never used them, never seen them used. Just return NULL if the input size is 0.<br>
<a href=\"/g/thread/92750475#p92764145\" class=\"quotelink\">&gt;&gt;92764145</a><br>
based. more people should read it. lots of pajeet code in there, but the kernel and low level code is great.<br>
<a href=\"/g/thread/92750475#p92764193\" class=\"quotelink\">&gt;&gt;92764193</a><br>
GetTempPath/GetTempFileName/CreateF<wbr>ile<br>
<a href=\"/g/thread/92750475#p92764359\" class=\"quotelink\">&gt;&gt;92764359</a><br>
<a href=\"/g/thread/92750475#p92764402\" class=\"quotelink\">&gt;&gt;92764402</a><br>
<span class=\"quote\">&gt;and then delete said file after youre done with it</span><br>
Pass FILE_ATTRIBUTE_TEMPORARY | FILE_FLAG_DELETE_ON_CLOSE to CreateFile in the dwFlagsAndAttributes parameter. Easy.<br>
<a href=\"/g/thread/92750475#p92764413\" class=\"quotelink\">&gt;&gt;92764413</a><br>
Shits unreadable bro. Stop cramming so much shit into each statement and add some fucking comments.<br>
<span class=\"quote\">&gt;The file is just a single heap allocated block of memory</span><br>
You can use a file mapping to &quot;load&quot; a file into memory without having to do a heap allocation. CreateFile/CreateFileMapping/MapVie<wbr>wOfFile and boom you have the contents of the file in memory. It&#039;s efficient and uses less physical memory than heap allocation.<br>
<a href=\"/g/thread/92750475#p92766628\" class=\"quotelink\">&gt;&gt;92766628</a><br>
The code changes to use a table if you have 100 shapes. The best solution for any problem depends on the problem, and doing shit to calculate 3 kinds of shapes isn&#039;t even remotely the same as for 30 kinds of shapes.<br>
<a href=\"/g/thread/92750475#p92766776\" class=\"quotelink\">&gt;&gt;92766776</a><br>
linux config files are a disaster anyway, no harm in inventing one more format to throw on the pile. kek.<br>
<a href=\"/g/thread/92750475#p92768358\" class=\"quotelink\">&gt;&gt;92768358</a><br>
<span class=\"quote\">&gt;rumours about the NT kernal</span><br>
read the source. download the WRK from github. that code used to run on every PC in existence.
#+end_src
- [ ] Multi-quote messages are separate by 2 <br><br>
- [ ] Link to Message on another Thread
>>92748198 →
<a href="/g/thread/92745370#p92748198" class="quotelink">&gt;&gt;92748198</a><br>
- [ ] Normal text is urlencoded
Made me smile, Thank G'yoo
Made me smile, Thank G&#039;yoo
- [ ] Normal text might have a random *<wbr>*
- [ ] Normal text has *<br>* for new lines
Hi guys got a question
I'm using Automatic 1111
how do I increase the generation batch count?
I want to let it run overnight but I'm capped at 100 and I burn that in like two hours
Hi guys got a question<br>I&#039;m using Automatic 1111<br>how do I increase the generation batch count?<br>I want to let it run overnight but I&#039;m capped at 100 and I burn that in like two hours
18 changes: 18 additions & 0 deletions internal/fourchan/fetch.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package fourchan

import (
"github.com/moshee/go-4chan-api/api"
)

func Fetch(rawUrl string) (*Thread, error) {
threadId, board, err := parseUrl(rawUrl)
if err != nil {
return nil, err
}
apiThread, err := api.GetThread(board, int64(threadId))
if err != nil {
return nil, err
}
thread := toThread(apiThread)
return thread, nil
}
16 changes: 16 additions & 0 deletions internal/fourchan/fetch_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package fourchan

import (
"fmt"
"testing"
)

const URL = `https://boards.4channel.org/g/thread/92748329/sdg-stable-diffusion-general`

func TestFormatThread(t *testing.T) {
thread, err := Fetch(URL)
if err != nil {
t.FailNow()
}
fmt.Println(thread)
}
Loading

0 comments on commit 2a5dce0

Please sign in to comment.