In Resilio Sync, how to add multiple keys at once - bittorrent-sync

With Resilio Sync, I'm looking for a way to add multiple keys at once with a CSV file or run a script or copy-paste to a config file or whatever else.
Currently, I have a list of 10 keys I must set up on a laptop.
For each I have to click the '+' then 'Enter a key then copy paste the path to the folder I created for it.
I would prefer to have a list like this I could just load or parse with a script.
KEY,Folder Path,Selective sync
I6HK76FRZS...,C:\Sync\Folder1,No
76FRI6HKZS...,C:\Sync\Folder2,No
HK76FI6RZS...,C:\Sync\Folder3,No
.....
This would help reduce errors in copying and pasting information.
I've tried exploring the Internet and it looks like no one else has ever needed to do anything like this. :/ Hard to believe.
I've also tried researching the config file to see if I could add the information there.
https://help.resilio.com/hc/en-us/articles/206178884-Running-Sync-in-configuration-mode#windows
Storing the information permanently in raw text on a config file does not sound ideal.

Related

How do I configure mplayer to use a default edl file name?

I want to configure mplayer to look for an edl when playing a video. Specifically, I want it to use "show.edl" when playing "show.mp4", assuming both are in the same directory. Very similar to how it looks for subtitles.
I can add a default edl in the config file by adding the following:
edl=default.edl
And this will look for the file "default.edl" IN THE CURRENT DIRECTORY, rather than in the directory where the media file is. And it isn't named after the media file either, and thus even if it did look in the right place, I'd have one single edl file for every media file in that directory.
Not really what I wanted.
So, is there a way, in the "~/.mplayer/config" file, to specify the edl relative to the input file name?
Mplayer's config file format doesn't seem to support any sort of replacement syntax. So there's no way to do this?
MPlayer does not have a native method to specify strings in the config file relative to the input file name. So there's no native way to deal with this.
There's a variety of approaches you could use to get around that. Writing a wrapper around mplayer to parse out the input file and add an "-edl=" parameter is fairly general, but will fail on playlists, and I'm sure lots of other edge cases. The most general solution would of course be to add the functionality to mplayer's config parser (m_parse.c, iirc.)
The simplest, though, is to (ab)use media-specific configuration files.
pros:
Doesn't require recompiling mplayer!
Well defined and limited failure modes. I.E. the ways it fails and when it fails are easily understood, and there aren't hidden "oops, didn't expect that" behaviors hidden anywhere.
Construction and updating of the edl files is easily automated.
cons:
Fails if you move the media around, as the config files need to full path to the edl file to function correctly.
Requires you have a ".conf" file as well as an EDL file, which adds clutter to the file system.
Malicious config files in the media directory may be a security issue. (Though if you're allowing general upload of media files, you probably have bigger problems. mplayer is not at all a security-hardened codebase, nor generally are the codecs it uses.)
To make this work:
Add "use-filedir-conf=yes" to "/etc/mplayer.conf" or "~/.mplayer/config". This is required, as looking in the media directory for config files is turned off by default,
For each file "clip.mp4" which has an edl "clip.edl" in the same directory, create a file "clip.mp4.conf" which contains the single line "edl=/path/to/clip.edl". The complete path is required.
Enjoy!
Automatic creation and updating of the media-specific .conf files is left as an exercise for the student.

How to replace value in txt file with powershell from GitHub

I want to build a simple script that may be useful for others as well, but I have only very basic programming knowledge and can't do it myself without learning how to write powershell scripts from scratch.
What this script is supposed to do is, open an INI file (really just a txt), look for a variable with an assigned value and replace that value from a txt hosted on GitHub, save and then run a program.
This is for the tracker list of qBittorrent, since that feature still hasn't been implemented and the only other script that I could find that does this is for linux and mac, there seem to be none for windows.
The basic idea is this:
get-content "c:\users\[user]\appdata\roaming\qbittorrent\qbittorrent.ini"
# This is where pseudo code starts
get file from "[github-link.txt]"
save file to cache # keeping it is useless as it gets updated daily
find variable "Session\AdditionalTrackers=" in qbittorrent.ini
replace value of variable with content of cached file # this is what I struggle with most when looking for example code. Everything I could find specified the exact string that needed replacing, which in this case is quite long and may change with every update of the file.
overwrite original file
launch program qbittorrent.exe
end script
Conveniently or most likely deliberately all (most) of the tracker lists on GitHub are already formatted in a way that they can be directly pasted into the file without having to worry about formatting. Example.
I can totally understand if nobody wants to do the work, but I would greatly appreciate it and possibly others that are looking for a stopgap for the lacking feature.
If this already exists, go ahead and call me an idiot and while you're at it drop a link ;)
I just found a little tool called Power Automate and it pretty much does what I was looking for. It's not quite as elegant as a single click script but it does the job. Sadly I can't share the "flow" I built because, well, there is no option for it - thanks Microsoft. So, I'll try my best to write it out.
Not quite a "solution" but pretty to close to it.
Here is the "flow":
get file from web // from github for example
read text from file // read downloaded .txt file
read text from file // read qBittorrent.ini
crop text // crop between flags in qBittorrent.ini use "Session\AdditionalTrackers=" as start and "Session\GlobalMaxRatio=" as end and save to cropVar2
crop text // crop before flag use "Session\AdditionalTrackers=" as flag and save to cropVar1
crop text // crop after flag use cropVar2 as flag and save to cropVar3
replace text // replace cropVar2 with content of downloaded file and save to cropVar2
write text to file // write cropVar1,cropVar2,cropVar3
end flow
Keep in mind that any changes to the qBittorrent.ini may change the order of the entries. Which means you have to check if it's still correct after every update and after every change you make in the options. This is a massive cludge after all...
You can input fail saves so that you won't break anything if the order changed.

How can I find out what file mode VSCode is using for an open file?

I was trying to get yapf configured for a Python project, and so I created a .style.yapf file, which VSCode did not recognize by its extension. I thought it was in TOML format, but when I changed the file association for .style.yapf to TOML, the parser shows an error (because values aren't quoted). So I tried changing the name of the file (not really a solution, because the tool is looking for a file with that name), and found that if I change it to a name ending in .cfg, VSCode seems to parse and highlight it appropriately. Unfortunately, there doesn't seem to be anything in the list of file associations corresponding to this file mode.
I expected to find a cfg mode in the file associations list, but there wasn't an entry with that name, nor was there an entry that used the same gear icon displayed next to the open file name in its tab (which I have been assuming is an indicator of the mode that VSCode is using to display and format the file).
Is there any way for me to get VSCode to tell me what the current file mode is for an open file? Or give me a list of the default associations?
I'm more interested in understanding the tools in general than solving the one minor annoyance that sparked the question, but I'll settle for a solution to that problem, too.
Edit: Here's the content of the .style.yapf file in question:
[style]
based_on_style = google
If I rename the file to .yapf.cfg (or any other name ending in .cfg, I believe), it gets handled properly, but all of the file associations I've tried (including ini, Properties, and TOML) indicate an error because there are no quotes around google.

Photorec custom signature

Recently I have lost my database files after server (Qnap) reboot.
I need to recover the MYD files.
I'm using the Photorec to recover my files which uses file signatures.
I know that MYD files doesn't have common file signature.
I've recreated the database from the earlier backup (on local machine) just to check if the signature changes when new data inserted and it seams like the signature bit is not changing.
I'm not sure if that means I have the signature of the file that I'm looking for.
I've tried to create a photorec.sig file and entered MYD 0 0x00010065fe00000100003101aa70010f00 which are the first 34 chars of the hexdump result.
I've saved this file into the current working directory and ~/.photorec.sig and tried to recognize the MYD file with fidentify_static which always returns unknown.
I think there is something wrong with the signature file that I've created. Can anyone tell me how to make sure that the signature file is created correctly and placed to the right place on qnap?
Run fidentify with the file/directory as the parameter:
[kmaster#adsl ~]$ fidentify /home/kmaster/src/testfiles/sample.pfi
See http://www.cgsecurity.org/wiki/Add_your_own_extension_to_PhotoRec

Scratch output file .txt or similar

I want to know if there is an easy way to open a .txt file and load some comma delimited data into variables in Scratch and furthermore add some variable data from Scratch to a .txt file or similar?
I have done a fair bit of google searching but not come across anything so I thought I would ask you guys.
I would love to use Java or something but its for my school kids and I cannot teach them to do it in Java or something else as they need to do what they have to in Scratch which is annoying but something I cannot change.
Scratch does not have file IO capabilities, and i doubt it ever will.
The closest thing that i know of is importing/exporting a list. Right-click on the list watcher from the Scratch IDE, and export. It will produce a .txt file, with each list item on a new line. If you have a similarly formatting TXT file, you can import it using the same method. Each line corresponds to a list item. Comma delimited data doesn't work with this.
You can download and edit the json script for the Scratch project.
From the "See Inside" screen, File->Download to your computer.
Rename the file to have a ".zip" extension instead of just ".sb2".
Unzip the file to edit the "project.json" file.
Edit the list data under "ListName": "[your list]" as desired.
Reassemble the zip file
Remove the ".zip" extension. (Back to ".sb2")
Update the Scratch project by going to the original project and selecting File->Upload from your computer.
In this sample project I have a list called "Jobs". The project.json file has a section like this...
"listName": "Jobs",
"contents": ["Accountant",
"Actor",
"Advocate",
"Appraiser",
"Architect",
"Baker",
...
Make whatever changes you want directly to the section for your list.
Currently, Scratch has no IO abilities, as the answer above me said, But there is a mechanism called JS extenions. Currently it's a closed beta, but when it will be released everyone would be able to program Javascript extensions for scratch. That means that you will be able to create a "Open file" block yourself.