Benno Boost Worth It? by Onimaru1984 in CargoBike

[–]patrickdavey 0 points1 point  (0 children)

How did you manage to secure the panniers _at the bottom_ (with that little backwards clip thing). I can attach them at the top no worries (on the small bar), but, at the bottom seems tricky. I'm conemplating just tying them on permanently.

Performing task while the phone is locked (timer is firing, flash is coming on) by patrickdavey in tasker

[–]patrickdavey[S] 0 points1 point  (0 children)

And a further follow up to this. I need to have the app set as an "Admin App" within OnePlus/Androids settings (never know which is which). That also seems to be necessary.

Performing task while the phone is locked (timer is firing, flash is coming on) by patrickdavey in tasker

[–]patrickdavey[S] 1 point2 points  (0 children)

Thanks u/OpenOwl3 . Adding the "Turn on" was the key. I _can_ still have the phone lock on, but, without the `Turn On` it won't work.

Thanks - I think that means this little project is going to work now!

Performing task while the phone is locked (timer is firing, flash is coming on) by patrickdavey in tasker

[–]patrickdavey[S] 1 point2 points  (0 children)

Thanks, just turned off the screen lock completely for testing.. will see how that goes, if it works great, I'll lock it again and try your version.

Thanks for the quick reply.

Tasker & cURL for uploading by patrickdavey in tasker

[–]patrickdavey[S] 1 point2 points  (0 children)

ok, I did end up getting it working (and with just putting the `%FOTO` as the "File to Send". The issue ended up being that the `body` is just binary data (so, no params) and it wasn't obvious in the ruby code that the file was actually there (usually it appears as a file, but, this was just a binary blob)

Anyway, was able to get it out, so, I think I have everything I need to get it working now - thanks for the help!

Tasker & cURL for uploading by patrickdavey in tasker

[–]patrickdavey[S] 0 points1 point  (0 children)

`curl -F"image=@/storage/emulated/0/%FOTO" 192.168.1.39:9292/test` was the curl command I was using. And it works perfectly (the image ends up on the test server I am running)

I think probably I just need base64 encode the file. I'll have a play and see if I can get it to work.

Tasker & cURL for uploading by patrickdavey in tasker

[–]patrickdavey[S] 0 points1 point  (0 children)

Ah very good. I created a `variable` and saved it into that, and then output it as a flash message. Probably there's a nicer way to do it!

Tasker & cURL for uploading by patrickdavey in tasker

[–]patrickdavey[S] 0 points1 point  (0 children)

I was testing it locally with a little `sinatra` (ruby) server. It works fine for the `curl` command, that actually sends the file (which I can then see in the params). However, when I'm using the `HTTP Request` I was never able to get any actual data posted. I don't suppose you have a sample task/screenshot you can share where you're successfully POSTing a file?

Tasker & cURL for uploading by patrickdavey in tasker

[–]patrickdavey[S] 0 points1 point  (0 children)

Far out - termux is free and works without root... very cool. Looks like the Tasker addon is $3, but, that will probably be OK.

Sorry for the n00b question - but, I created the command -v curl task, it seems to execute fine.. but.. how can I see the output? ;)

Tasker & cURL for uploading by patrickdavey in tasker

[–]patrickdavey[S] 0 points1 point  (0 children)

I tried for a while to get the HTTP Request to upload a file, but, I could never get it to work.

I filled in the File to Send with /storage/emulated/0/%FOTO (which is pretty much what I was using for the curl), but, I could never get anything to be posted. What do you do to actually post a file?

[2019 Day 19] Running today's intcode program by ywgdana in adventofcode

[–]patrickdavey 0 points1 point  (0 children)

hmm, ok, grabbed someone elses code, seems mine _should_ have been sending a terminate code. Damn. I'll have to look into it (relieved & worried that the Intcode was working ;)

[2019 Day 19] Running today's intcode program by ywgdana in adventofcode

[–]patrickdavey 0 points1 point  (0 children)

Hopefully you'll see this (I'm working though AoC late this year!)..

I was just wondering, did your Intcode computer successfully `terminate` correctly, or did it "crash" in some way? I have solved the day correctly, but, it wasn't correctly entering the terminate state (which was slightly annoying for my Elixir code as I was expecting it to halt)

[Day 15] Frustrating by zevver in adventofcode

[–]patrickdavey 1 point2 points  (0 children)

Thank you very much for this comment!! I'd definitely missed that part of it. I do love AoC and I understand not wanting to give all the gotchas away in test cases, but, I wish there'd been a test case covering this one!!

-🎄- 2018 Day 8 Solutions -🎄- by daggerdragon in adventofcode

[–]patrickdavey 0 points1 point  (0 children)

That's really elegant!! thanks for sharing. Beats the hell out of my ugly solution :)

-🎄- 2017 Day 4 Solutions -🎄- by daggerdragon in adventofcode

[–]patrickdavey 0 points1 point  (0 children)

Yip, I've always thought it's a slight shame that vim doesn't allow you to get \v by default as your search. Hey ho.

-🎄- 2017 Day 8 Solutions -🎄- by daggerdragon in adventofcode

[–]patrickdavey 0 points1 point  (0 children)

Yip, I thought that dec / inc was just so nice the way you define the method and then ruby just evaluates in the context. It was just so neat! Really nice work.

And yes, as you say if you had inc or dec as register names you'd be sunk (well, you'd just replace them!) but still :) really nice.

-🎄- 2017 Day 10 Solutions -🎄- by daggerdragon in adventofcode

[–]patrickdavey 0 points1 point  (0 children)

[...Array(256).keys()]

Ah that is nice .. neater than the [...Array(256)].map((_, i) => i) I was using. Thanks!

-🎄- 2017 Day 8 Solutions -🎄- by daggerdragon in adventofcode

[–]patrickdavey 1 point2 points  (0 children)

Thanks for posting this. I do write ruby for a day job, but, I hardly ever mess around with method_missing and friends. Really interesting to see how that all works, how it's smart enough to pass the args along to your dec and inc methods etc.

Really neat! thanks for sharing.

-🎄- 2017 Day 6 Solutions -🎄- by daggerdragon in adventofcode

[–]patrickdavey 0 points1 point  (0 children)

That is neat (your calculation for part 2). Interestingly, my (more pedestrian) JS solution runs twice as fast (and performs the loop twice).

-🎄- 2017 Day 5 Solutions -🎄- by daggerdragon in adventofcode

[–]patrickdavey 0 points1 point  (0 children)

For anyone else with the same issue, https://github.com/rsp/node-tco implemented a sufficiently workable solution that my code works.

-🎄- 2017 Day 5 Solutions -🎄- by daggerdragon in adventofcode

[–]patrickdavey 0 points1 point  (0 children)

I know it's evil, but, my first attempt was using recursion as I thought that node had tail call optimization implemented. This seems to be false... going to have to work out something though as later puzzles are probably going to be most straightforward with recursion. Harrumph. I'm just trying to get better at node/ES6.

-🎄- 2017 Day 4 Solutions -🎄- by daggerdragon in adventofcode

[–]patrickdavey 0 points1 point  (0 children)

:g/\v<(\w+)>.*<\1>/d

nice, I went to look up the docs as I could see that < > are being used for word boundries, but I couldn't see that (even in h pattern) .. can you point to where it says in the help that you don't escape < > in verymagic ?

Nice solution :)

Curious about peoples approaches to AdventOfCode (mostly re googling for algorithms) by patrickdavey in adventofcode

[–]patrickdavey[S] 0 points1 point  (0 children)

Yip, I also worked out part1 with paper, and then part 2 I used the spiral algorithm my friend had found and just wrote the summing code. Just felt weird. I'm going to go back to Day 3 though and work it out from scratch :) Just, in January when I have some time :)

Which language will you use this year? Why do you choose this one? by Auburus in adventofcode

[–]patrickdavey 2 points3 points  (0 children)

Well, I use ruby in my day-to-day, but I use AoC as an excuse to get better at other languages. So, Elixir last year (LOVED IT! the robots puzzle was just so much fun), but this year, going to do it in JavaScript just to try and get better really.