[LXD] Commands for LXD/LXC

The commands for lxd/lxc :

 

Configuring a new LXD installation for the first time

sudo lxd init

 

Checking LXD version

sudo lxd --version

Listing all image servers

sudo lxc remote list

 

Getting a list of available images from an image server

sudo lxc image list images:

 

Getting a filtered image list from an image server

 

Creating a new container

Or

sudo lxc launch images:[type_of_container] [your_container_name]

 

Starting a container

sudo lxc start [your_container_name]

 

Stopping a container

sudo lxc stop [your_container_name]

Removing a container

sudo lxc delete [your_container_name]

 

Connect to a container via command line

sudo lxc exec [your_container_name] -- /bin/bash

 

TODO

 

Ref. from:

https://linuxcontainers.org/lxd/getting-started-cli/#importing-some-images

http://bartsimons.me/lxd-cheat-sheet-for-beginners/

[Bash shell] Find something in some files

Command “find” is one of the most powerful command in linux, here is an exmaple that allows list the files which contain something.

find . -name \*.[type of your files] -exec grep -q "[text that you want to search]" "{}" \; -print

For example, I have two shell files in my folder :

 
$ ll
drwxrwxr-x 3 bo bo 4096 juin 13 14:56 ./
drwxr-xr-x 16 bo bo 4096 juin 13 14:04 ../
-rwxrwxrwx 1 bo bo 2554 juin 12 18:05 first.sh*
-rwxrwxrwx 1 bo bo 1283 juin 12 16:10 second.sh*

And I want to find the string “spark” in these files

$ find . -name \*.sh -exec grep -q "spark" "{}" \; -print

And I got :

./second.sh

[French Vocabulary] Réputation / Renommé

It is very important to distinguish the nuance of the vocabulary, especially they have the closed meanings.

Il est très important de connaître et distinguer les nuances des mots, surtout s’ils ont des sens proche.

了解一些近义词的细微差别灰常重要,尤其是在有褒贬意的时候,使用不当,适得其反。

 

For example, réputation et renommé

Par exemple, en français : réputation et renommé

比如说,réputation et renommé

 

Il a une réputation de chaud lapin. 他以比较黄出名。
(In this sentence, réputation has a negative meaning. )
(Dans cette phrase, le mot réputation a un sens négative. )
(réputation本意为声誉,但是这句话表达的却是不好的声誉,所以在使用时要当心,用不好要被揍 😉 )
C’est un vin renommé 这是一种有名的酒
(这句话里renommé就比较中性,没有褒贬意)
Et grand remerciement à Aurélie pour m’aider à apprendre le français.

[PHP]memory limit

 

Encountered problem :

PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 32 bytes)

 

Tempory solution for debug :

Add ini_set(‘memory_limit’, ‘-1’);  in for example index.php to turn off the default memory control of PHP.

This is not the best solution, because it means that the program can use as much memory as it wants, maybe that will cause a memory overflow. The best way is to improve the program, for example pagnation to a batch etc.

[GIT command] Branch

Here are some git commands concerning the manipulation of branchs.

# List all the remote branchs

# Checkout a remote branch

$ git checkout -b my_local_branch origin/my_remote_branch

# Delete a local branch

$ git checkout -d my_local_branch

 

[GIT commands] Kickoff

To start a git project, it is better to know some useful commands in order to understand how it works. This article allows me to memory some useful git commands.

I suppose there is aleready a git remote repository (something like github, bitbuckets, gitlab etc.) and already done “git init” in local directory.

So let’s begin.

Two things we have to consider :

  1. We have nothing in our local environment, what we want to do is just donwload the code from remote repository
    • First of all, find the l’url of the remote repository (for example github), I’ill take Microsoft TypeScript for instance. We have two types of URLs : SSH or HTTPS. Take one of them. Normally, there is no difference.
    •   
    • Execute “git clone ” command with the url

    Continue reading