Archive

Posts Tagged ‘dropbox’

How to sync my Visual Studio Code settings using Dropbox?

February 13, 2020 Leave a comment

Problem
You set up your VS Code, spend half a day with your settings / extensions / snippets, and you want to use the same settings across all your machines (including Linux and Windows boxes too). How to do it?

Solution
First, let’s see where your settings are located.

Linux

Location of your settings: ~/.config/Code/User . The important entries are:

  • settings.json
  • keybindings.json
  • snippets/ (directory)

Location of your extensions: ~/.vscode/extensions .

Windows

Location of your settings: C:\Users\username\AppData\Roaming\Code\User (on Windows 10). The important entries are the same:

  • settings.json
  • keybindings.json
  • snippets/ (directory)

Location of your extensions: C:\Users\username\.vscode\extensions (on Windows 10).

——————–

To share your settings, create a folder in your Dropbox folder and move there the files settings.json, keybindings.json, and the folder snippets/ .

Then go to your local User folder and put symbolic links on the three entries that you just put in Dropbox.

Don’t store the extensions in Dropbox! Sometimes they install binary files that are different under Windows and Linux. Simply install the extensions locally on all your machines.

To get a list of your extensions, run the command “code --list-extensions” in the terminal.

How to create symbolic links under Windows?
Open a terminal window in administrator mode. Then,

# symbolic link on a file:
mklink Link Target

# symbolic link on a directory:
mklink /d Link Target

How to sync my Sublime Text 3 settings using Dropbox?

February 11, 2020 Leave a comment

Problem
You re-install a Linux machine and you want to use your Sublime Text 3 editor settings on this machine too. How to sync your complicated settings?

Solution
The answer is here: link.

To properly sync your installed packages across different machines, you actually do not want to sync the whole Packages/ and Installed Packages/ folders. The reason for this is that some packages have different versions for different operating systems. By syncing the actual package contents across operating systems, you will possibly run into broken packages.

To sync the folder, you generally move Packages/User/ into your Dropbox and create a symlink to it from Sublime Text 3/Packages/.
” (source)

Dropbox is stuck at syncing

February 11, 2020 Leave a comment

Problem
Under Ubuntu 18.04, my Dropbox client stopped working. I have a big Dropbox folder and it synced at least 90% of it. But then, it simply indicated “Syncing…” and nothing happened. I left it like that for a night but next morning it was still “Syncing…”. What da hell?

Solution
I stopped the client and launched it from the command-line:

$ cd ~/.dropbox-dist/
$ ./dropboxd &

And luckily it dropped an error message on the screen:

Unable to monitor entire Dropbox folder hierarchy. Please run "echo fs.inotify.max_user_watches=100000 | sudo tee -a /etc/sysctl.conf; sudo sysctl -p" and restart Dropbox to fix the problem.

So that’s it. This Ubuntu box of mine was freshly installed and the default settings were not good for Dropbox. After executing the proposed command, Dropbox started to work normally.

Thus, the command to issue is:

echo fs.inotify.max_user_watches=100000 | sudo tee -a /etc/sysctl.conf; sudo sysctl -p
Categories: linux, ubuntu Tags: , ,

Dropbox: .html files in your Public folder are no longer rendered in the browser

October 4, 2016 Leave a comment

Problem
Until now I’ve stored a lot of teaching material in my Dropbox’s Public folder that I shared with my students. Here I had a generated index.html file in each folder that one could render in the browser. This way, you could have a static HTML site in your Public folder that you could share easily, and any changes to it were synced automatically.

However, Dropbox changed his mind:

Dropbox Basic (free) users: Beginning October 3, 2016, you can no longer use shared links to render HTML content in a web browser. If you created a website that directly displays HTML content from your Dropbox, it will no longer render in the browser. The HTML content itself will still remain in your Dropbox and can be shared. Learn more.

Dropbox Pro and Business users: Beginning September 1, 2017, you can no longer render HTML content.” (source)

The good times are over :(

Solution
I faced this problem this morning and I started to look for an alternative. A friend of mine, Füli, suggested that I should move to github.io. And that’s what I did :) In an hour the migration was done. Here is the result: https://github.com/jabbalaci/teaching-assets.

Congratulations, Dropbox, you managed to kill one of your most attractive features…

Categories: Uncategorized Tags: , ,

Remove “conflicted copy” files in your Dropbox folder

October 13, 2015 Leave a comment

Here is a quick solution to remove conflicted copies:

#!/usr/bin/env bash

# just print
find . | grep "conflicted copy 2015" | while read i; do echo $i; done

# print and DELETE
#find . | grep "conflicted copy 2015" | while read i; do echo $i; /bin/rm "$i"; done

Put it in your ~/Dropbox folder and launch it. First it will just print the conflicted copies. If you want to get rid of these files (verify!), then uncomment the last line.

The string “2015” is added to narrow the produced list. But normally “conflicted copy” should be enough.

Categories: bash Tags: ,

dropbox: command-line interface

September 12, 2015 Leave a comment

Problem
I wanted to test the status of my Dropbox client from the terminal. Actually, I wanted to write a script that executes an action when my Dropbox folder is fully synced. So I wanted to test the status if it’s “working” or “synced”.

Solution
I found the solution here. It turned out that Dropbox has an official command-line script that can do this and much more. First, get it:

wget -O ~/dropbox.py https://www.dropbox.com/download?dl=packages/dropbox.py
chmod u+x ~/dropbox.py
~/dropbox.py status

This is a Python script, written in Python 2, thus I modified the first line to be “#!/usr/bin/env python2“.

This script can do several things for you:

$ dropbox.py 
Dropbox command-line interface

commands:

Note: use dropbox help  to view usage for a specific command.

 status       get current status of the dropboxd
 help         provide help
 puburl       get public url of a file in your dropbox
 stop         stop dropboxd
 running      return whether dropbox is running
 start        start dropboxd
 filestatus   get current sync status of one or more files
 ls           list directory contents with current sync status
 autostart    automatically start dropbox at login
 exclude      ignores/excludes a directory from syncing
 lansync      enables or disables LAN sync

Some years ago I wrote a simple script to get the public URL of a file in my Dropbox folder. This script can do that too with the “puburl” command.

Categories: bash, python Tags: , ,

dropbox: remove conflicted copies

January 3, 2015 Leave a comment

Problem
If you have Dropbox installed on several machines, sometimes one of the clients litter your Dropbox folder with conflicted copies. Their number can be up to hundred(s). How to get rid of them?

Solution
First, locate the conflicted copies:

$ cd ~/Dropbox  # or wherever your Dropbox folder is
$ find . | grep "conflicted copy"

Investigate the result and make sure they can be deleted.

# one more check:
$ find . | grep "conflicted copy" | while read i; do echo $i; done

# if you are absolutely sure, delete them:
$ find . | grep "conflicted copy" | while read i; do echo $i; \rm "$i"; done

Notice that “$i” is between quotes since these filenames contain spaces.

Categories: bash Tags: ,