Archive

Posts Tagged ‘sync’

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)

Firefox: sync add-ons on your machines

October 13, 2016 Leave a comment

I knew that Firefox could do synchronization with multiple machines but I never tried it. It changed today. I got fed up with the manual sync so I looked after it and found this nice description of the process: https://support.mozilla.org/en-US/kb/sync-your-add-ons-another-copy-firefox . For this you need a free Firefox account.

Categories: firefox Tags: ,

using git like svn

March 15, 2016 Leave a comment

Problem
I have a Digital Ocean virtual private server (VPS) where I want to run a Python-Flask project of mine. The application works well on localhost, so it’s time to make it public.

However, it’s very likely that I will have to customize it a bit on the server, and thus I would like to get those changes on my localhost too. And vice versa, if I do some changes on localhost, I want to upload the new version to the server too. Copying everything via FTP for instance is out of the question. How to do it then?

Solution
Let’s use Git. Bitbucket offers free private repositories, so let’s profit of that :) I want to use that repo similarly to SVN: it’s the central repo, it must contain the latest version.

git_like_svn

Let “client A” be the VPS and “client B” my home machine (see the figure). When I modify something on localhost, upload the changes to the central repo, log in to the server and download the latest edition. If I modify something on the server, upload the changes to the central repo, and download them on my localhost. This way the two clients are nicely synchronized.

How to upload?
Upload your local changes to the central repo:

$ git status
$ git add -A .
$ git commit -m "your commit message"
$ git push
$ git status

How to download?
Download changes from the central repo (update your local copy):

#!/usr/bin/env bash

# git_down_from_central_repo.sh

git fetch
git pull
git status

But… it’s SVN like this!
Works for me :)

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: , ,

how to create a pull request on GitHub

June 20, 2014 Leave a comment

Explained step by step here: http://stackoverflow.com/questions/14680711/how-to-do-a-github-pull-request/14680805#14680805.

In short: fork the repo you want to contribute to; clone it to your local machine; do the changes, commit, then push it back to your repo. Then create the pull request on the web interface of github: visit your repo and click on the “pull request” button. Fill out the necessary information and create the pull request. The project’s owner will be notified about your contribution.

Once your PR is merged, you can sync your local fork to the upstream repository (howto).

Categories: Uncategorized Tags: , ,

Linux host, Windows guest, shared Dropbox folder

February 16, 2014 Leave a comment

Problem
My primary operating system is Linux but since I need to work with Powerpoint too, I installed Windows 7 in VirtualBox. Under Windows I prepare my presentations but I want them synchronized on all my machines. For the synchronization I was using Dropbox.

I had Dropbox on Linux (host machine) and on Windows (guest machine) too. When I edited a file under Windows, Dropbox synced it to the Linux host too (the Windows client uploads it to the cloud; the Linux client downloads it from the cloud). It worked fine, though it was not not optimal. If I didn’t use the Windows guest for a long time, then after a boot I had to wait some time till Dropbox synced everything and I could start working only after that.

However, something happened to the Windows Dropbox client recently. Maybe it’s a bug, I don’t know, but the Dropbox client in my Windows guest became terribly slow. It keeps syncing but it doesn’t upload the changes, or I need to wait an hour or so to upload a file 1 MB of size. This is ridiculous and unacceptable. Note that I dind’t experience similar issues with the Linux client.

How to have a synchronized folder between a Linux host and a Windows guest without a Dropbox client on the guest?

Solution
First I made sure that my Dropbox folders were synced between the host and the guest. After this I uninstalled Dropbox on Windows and removed the C:\Dropbox folder entirely. Since it was synced with the Linux host, I had an exact copy of the Dropbox folder on Linux. Then shut down the Windows guest.

Here (http://www.maketecheasier.com/share-files-in-virtualbox-between-vista-guest-ubuntu-host) you can find an excellent post on how to set up a shared folder between a Linux host and a Windows guest. On the Linux host I shared my Dropbox folder ($HOME/Dropbox) that appears now as a new drive in the Windows guest (G:\ in my case). Now, if I modify something under Windows, it will be visible immediately in the Linux file system that the Dropbox client on Linux will notice and sync.

With this I could solve two problems. First, when I boot up the Windows guest, I don’t need to wait for the Dropbox client to sync. Second, if I change something under Windows, it is still synced to the Dropbox cloud, though I have no Dropbox client on Windows anymore.