shortcut | description |
---|---|
!^ |
first argument |
!$ |
last argument |
!* |
all arguments |
!:2 |
second argument |
!:2-3 |
second to third arguments |
!:2-$ |
second to last arguments |
!:2* |
second to last arguments |
!:2- |
second to next to last arguments |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const query = datastore | |
.createQuery('Task') | |
.filter('done', '=', false) | |
.filter('priority', '=', 4); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const functions = require('firebase-functions'); | |
const admin = require('firebase-admin'); | |
admin.initializeApp(functions.config().firebase); | |
const gcs = require('@google-cloud/storage')(); | |
const exec = require('child-process-promise').exec; | |
const LOCAL_TMP_FOLDER = '/tmp/'; | |
/** | |
* When an image is uploaded in the Storage bucket the information and metadata of the image (the |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const admin = require('firebase-admin'); | |
const functions = require('firebase-functions'); | |
const gcs = require('@google-cloud/storage')({keyFilename: | |
'adotapet-476b5-firebase-adminsdk-p67hf-60281ac514.json'}); | |
const spawn = require('child-process-promise').spawn; | |
admin.initializeApp(functions.config().firebase); | |
exports.generateThumbnail = functions.storage.object() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.helloGCS = (event, callback) => { | |
const file = event.data; | |
if (file.resourceState === 'not_exists') { | |
console.log(`File ${file.name} deleted.`); | |
} else if (file.metageneration === '1') { | |
// metageneration attribute is updated on metadata changes. | |
// on create value is 1 | |
console.log(`File ${file.name} uploaded.`); | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Storage = require('@google-cloud/storage'); | |
const readline = require('readline'); | |
// Instantiates a client | |
const storage = Storage(); | |
// [END functions_word_count_setup] | |
function getFileStream (file) { | |
if (!file.bucket) { | |
throw new Error('Bucket not provided. Make sure you have a "bucket" property in your request'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const Datastore = require('@google-cloud/datastore'); | |
// Instantiates a client | |
const datastore = Datastore(); | |
/** | |
* Gets a Datastore key from the kind/key pair in the request. | |
* |
Task | Conda command | Pip command | Virtualenv command |
---|---|---|---|
Install a package | conda install $PACKAGE_NAME |
pip install $PACKAGE_NAME |
X |
Update a package | conda update --name $ENV_NAME $PACKAGE_NAME |
pip install --upgrade $PACKAGE_NAME |
X |
Update package manager | conda update conda |
Linux/macOS: pip install -U pip Win: python -m pip install -U pip | X |
Uninstall a package | conda remove --name $ENV_NAME $PACKAGE_NAME |
pip uninstall $PACKAGE_NAME |
X |
Create an environment | conda create --name $ENV_NAME python=3.6 |
X | cd $ENV_BASE_DIR; virtualenv $ENV_NAME |
Activate an environment | source activate $ENV_NAME |
X | source $ENV_BASE_DIR/$ENV_NAME/bin/activate |
Deactivate an environment | source deactivate |
X | deactivate |
Search available packages | conda search $SEARCH_TERM |
pip search $SEARCH_TERM |
X |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/****************************************************************************************** | |
Copyright (C) 2008 Niklas Sondell, Storm Weather Center | |
This file is part of wgrib2 and could be distributed under terms of the GNU General Public License | |
Example of mysql table structure for use with this script: | |
create table wgrib2 (rt datetime, vt datetime, lat double, lon double, param varchar(80), level varchar(30), value double); | |
v1.0 5/2008 | |
10/2009 Jerry Stueve, tmpnam -> mkstemp, "LOAD DATA <<LOCAL>>" added |
Example: You have a branch refactor
that is quite different from master
. You can't merge all of the
commits, or even every hunk in any single commit or master will break, but you have made a lot of
improvements there that you would like to bring over to master.
Note: This will not preserve the original change authors. Only use if necessary, or if you don't mind losing that information, or if you are only merging your own work.
On master:
> git co -b temp