Copy selected text from VI in google cloud shell - google-cloud-shell

Trying to copy selected text from a file opened in VI on google cloud shell and paste it in another shell tab. If I select the text in visual mode it wouldn't work. On a local terminal I would use xclip, or shift(+ctrl) before selecting.
Is there a way to achieve this?

Assuming you're using Cloud Shell in the browser and not gcloud alpha cloud-shell ssh, you can simply select text with your mouse/cursor and it will copy it into your clipboard of the browser's OS. In normal or visual mode. See docs.
You then paste with middle click, shift+insert, ctrl+shift+v in Linux (assumption based on xclip reference).

Related

How to install realm studio on linux/Ubuntu?

I have downloaded realm-studio-1.20.0-x86_64.AppImage from realm studio. How do I install this image in order to browse encrypted realm
mobile database on my personal machine that is either exported or fetched from emulator or real device.
Note: I don't want to use stetho plugin for chrome as it dose not support encrypted realm mobile database browsing.
It is actually quite easy, all you need to do is set its privilege to be executable:
chmod +x realm-studio-1.20.0-x86_64.AppImage
And then you can run it now
./realm-studio-1.20.0-x86_64.AppImage
For someone how want to access .AppImage file using UI, follow below steps.
Make it executable by following Right Click on .AppImage file >> Properties >> Permission Tab >> Check “Allow executing the file as program.
Now run the program by double click on .AppImage file.

missing sqlite3 history file

I cannot find the command history created by sqlite3.
I have both Windows and Cygwin version.
Using the Windows binary, I can use up/down arrow to see previous commands, even from previous runs of command. But I can't find the file .sqlite_history. This answer suggests it should be in the home directory, but I can't find it there. I do have working a .sqliterc so I know it is the correct directory.
Using the Cygwin binary, I can't get the history to work at all. It seems history is not saved at all?
On the documentation page I cannot find any mention of history at all.
For Windows console programs, the command history is handled by the Windows console itself. There are separate history buffers for different programs and different console sessions, and these buffers are not stored anywhere by default. However, you can use the doskey tool to manage them manually.
Cygwin uses Windows pipes to emulate the Unix tty devices; this often results in programs not detecting that they are running in a console. Try running the program both from within the Cygwin shell and from the Windows shell.
The SQLITE_HISTORY environment variable, if it exists, specifies
the name of the command-line editing history file
To repeat the last command, just press the ↑ key, to search for older
ones — use Ctrl+R shortcut. History search It's faster to find a query than to type it again
By default, SQLite stores the history file in the user’s home directory
and names it .sqlite_history It’s in plain text, so you can view it
in your favorite editor. If you prefer to save it elsewhere, specify
the full path in the SQLITE_HISTORY environment variable.
source: https://antonz.org/sqlite-history
e.g:
cd ~
nano .sqlite_history

Symfony2 Console and clipboard

I am using Symfony2 Console as a stand alone component and I am looking for a way to copy some text on clipboard with a command. It must be for all Operating Systems.
For example:
php cli/console smth:copy
And when the command is run it must copy some text to user clipboard.
I've have google it and didn't found anything.
Is that possible an if is it how can i accomplish this task?

How do I use SQLite to read data from the Firefox cookies file?

In my Firefox profile directory there is a cookies.sqlite file which holds the data for Firefox's cookies. I grabbed the Firefox SQLite Manager extension and loaded this file, which works, but how can I use plain query commands to read the cookies out of that file?
This is what I've tried so far:
$ sqlite3 cookies.sqlite
sqlite> SELECT * FROM dbname.sqlite_master WHERE type='table';
SQL error: file is encrypted or is not a database
I can't even list the tables, so I'm not able to start trying to list the cookies yet. If I can connect I'd like to be able to read and write data there, but I'm new to SQLite.
I had the same problem trying to read the cookies.sqlite file on Mac OS 10.6.8 (Snow Leopard). I downloaded SQLite 3.7.10 from http://www.sqlite.org/download.html and then I could open the file.
Here's a walkthrough of what I did...
Download SQLite 3, go to your downloads folder and unzip the file so that you now have a new SQLite 3 sitting in your downloads folder.
Open up a new finder window, press CMD + Shift + G, in the 'go to' dialog that pops up enter ~/Library/Application Support/Firefox/Profiles and then press return.
Presuming you only have one Firefox profile, you should see a folder here called XXXXXXXX.default (where the XXX string will be some random characters). Open this folder, or if you have more than one profile, open the folder of the profile you are looking for.
Inside you will find the cookies.sqlite database file, you can use this here directly, but you might want to make a copy somewhere else to use without risk of messing up the one that Firefox uses. If you want to use the Firefox one directly then I think you have to quit Firefox first, otherwise it has a lock on the file.
Open a new terminal window, and drag the sqlite3 binary from the downloads folder to the terminal window, this should enter the path to sqlite3 onto the command line.
Now, drag the cookies.sqlite3 database (the original or your copy) to the terminal, press return in the terminal.
If all goes well you should get the sqlite> command prompt. If you enter .tables you should see the table moz_cookies, which you can then query and investigate further.
The following commands might help:
.mode column
.headers on
select * from moz_cookies where domain = '.stackoverflow.com';
You should see all the values stored in your cookie for this site.
If you want to update the existing sqlite3 on your Mac, I did sudo mv /usr/bin/sqlite3 /usr/bin/sqlite3.old (just in case of any future problems, I can move it back again) and then sudo mv ~/downloads/sqlite3 /usr/bin/sqlite3.
I was able to open it with DBeaver, an open source universal database manager.
Use sqlite3
sqlite3 file.sqlite
Then use the below command to view the tables
.tables

Accessing SQLite database in android emulator

i am working on an android app which stores data in sqlite db i want to be able to access the data that is currently stored in the emulator. How do i go about connecting to it and perform sql operations.
Open a terminal window
Get a list of AVD devices by entering: adb devices
If your terminal can't find the adb command then have a look at this post for OSX or Windows.
Start a shell connection to your AVD by entering: adb -s emulator-xxxx shell
Browse to the databases location: cd data/data/your.package.name/databases
Type sqlite3 xxxxx.db
For SQLite shell instructions see Command Line Shell For SQLite
There is an example on that link about "sqlite command in adb"
In the eclipse, go in to FileExplorer, here you will find three root folders: here go in to
1.data
2.go in to data folder again
3. here you will find all the package names of the applications.
4. once you find your projects particular package, click on it.
5.you will see a folder called 'databases'
6.in that folder you will get the sqlite db file.
7.in order to pull it out of the emulator, just click on it and on the
top right corner you will find 3 icons: one to delete, one to pull a file from device and the other to push file in the device.
8. after selecting the db file, click on the icon that says 'pull a file from the device'.
Thats it mate ...cheers.

Resources