How to automatically stop charging at 80%

TLDR; It’s a bit of work, and you’d like to have some experience with electronics and Arduino. Basically I monitor charging current (or speed if you like) to determine when the charge on my iPhone battery has reached about 80%, and then cut power to the charger.

Note that on Android there are apps that will do this for you.

Also note that on iPhone you can use Automation in the Shortcuts app to send you a notification at a certain charge, and then take the phone off manually.

That said the method I use here could in theory be used to modify any device that uses lithium batteries. I must admit I did it mostly for the challenge, however I also find it useful.

Continue reading

Convert tab-spaced plain text table into table or excel

My girlfriend got handed som data in the form of plain unformatted text. It should have been a presented in a table like fashion, however it was generated by some python or terminal/cmd run program, and each column or cell was separated by a single tab character. (You know the key above the caps-lock that we dont tend to use in programming cause it behaves inconsistently between editors).

Anywhom, this is a hacked together piece of javascript, that reads trough a file, creates a table row pr line, and a column/cell pr tab. It will however only work right if there is the same amount of tabs in each line.

Select file, click the button, and then you can select all, copy it and paste it into excel.


Concatenate and reduce mp4 size with ffmpeg?

Might be kindof a hack, but this seem to automatically concat all the .mp4s in the current folder into one. It uses the foldername (stripped of whitespaces) for the output name. Might have numerous flaws, so use at own risk. Its just a mix and match of different snippets from stackoverflow.

Concat w/o re-encode:

for f in ./*.mp4; do echo "file '$f'" >> l.txt; done; ffmpeg -f concat -safe 0 -i l.txt -c copy $(printf '%s\n' "${PWD##*/}" | tr -d '[:space:]').mp4; rm l.txt

Re-encode to lower file-size:

ffmpeg -i input.mp4 -vcodec libx265 -crf 20 output.mp4

Continue reading

Sjokoladekake på tur

Ok, så kaka på bildet ser kanskje ikke ut som om den er laget av en konditor. Derimot smakte den helt fantastisk. Den ble også presentert som en kake, og ikke noe svidd røre i et appelsinskall. Oppskriften er ganske enkel, og tilpasset til at det skal bli minst mulig søl og oppvask.

“Hemmeligheten” viss du kun vil ha den, er å steike røra som pannekaker i stekepanne. Deretter legge dem lag på lag med fyll mellom. Kan gjøres på stormkjøkken eller på hytta.
Continue reading