Tutorial by Examples

Detailed instructions on getting glsl set up or installed.
Julia uses the standard mathematical meanings of arithmetic operations when applied to matrices. Sometimes, elementwise operations are desired instead. These are marked with a full stop (.) preceding the operator to be done elementwise. (Note that elementwise operations are often not as efficient as...
To get started: Install celery pip install celery configure celery (head to the remarks section) from __future__ import absolute_import, unicode_literals from celery.decorators import task @task def add_number(x, y): return x + y You can run this asynchronously by using the ....
Wrapper script is a script that wraps another script or command to provide extra functionalities or just to make something less tedious. For example, the actual egrep in new GNU/Linux system is being replaced by a wrapper script named egrep. This is how it looks: #!/bin/sh exec grep -E "$@&q...
You can have functions in the PS1 variable, just make sure to single quote it or use escape for special chars: gitPS1(){ gitps1=$(git branch 2>/dev/null | grep '*') gitps1="${gitps1:+ (${gitps1/#\* /})}" echo "$gitps1" } PS1='\u@\h:\w$(gitPS1)$ ' It will...
timeNow(){ echo "$(date +%r)" } PS1='[$(timeNow)] \u@\h:\w$ ' It will give you a prompt like this: [05:34:37 PM] user@Host:/path$ Notes: Make the changes in ~/.bashrc or /etc/bashrc or ~/.bash_profile or ~./profile file (depending on the OS) and save it. Run source ~/.ba...
This is how the author sets their personal PS1 variable: gitPS1(){ gitps1=$(git branch 2>/dev/null | grep '*') gitps1="${gitps1:+ (${gitps1/#\* /})}" echo "$gitps1" } #Please use the below function if you are a mac user gitPS1ForMac(){ git branch 2> ...
class ImageCreationExample { static Image createSampleImage() { // instantiate a new BufferedImage (subclass of Image) instance BufferedImage img = new BufferedImage(640, 480, BufferedImage.TYPE_INT_ARGB); //draw something on the image paintOnI...
public static void saveImage(String destination) throws IOException { // method implemented in "Creating a simple image Programmatically and displaying it" example BufferedImage img = createSampleImage(); // ImageIO provides several write methods with different outputs ...
static void setupQualityHigh(Graphics2D g2d) { g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); // many other RenderingHints KEY/VALUE pairs to specify } ...
We can just do simple replacement of separators from space to new line, as following example. echo $sentence | tr " " "\n" It'll split the value of the variable sentence and show it line by line respectively.
JSON: [ { "id": 8484, "name": "David", "height": 173.2, "weight": 75.42 }, { "id": 8485, "name": "Ronald", "height": 183.73, "weight": 83.1 } ] ...
getfunc() { declare -f "$@" } function func(){ echo "I am a sample function" } funcd="$(getfunc func)" getfunc func # or echo "$funcd" Output: func () { echo "I am a sample function" }
Create a simple DataFrame. import numpy as np import pandas as pd # Set the seed so that the numbers can be reproduced. np.random.seed(0) df = pd.DataFrame(np.random.randn(5, 3), columns=list('ABC')) # Another way to set column names is "columns=['column_1_name','column_2_name','c...
To check which process running on port 8080 lsof -i :8080
To transfer a file securely to another machine - type: scp file1.txt tom@server2:$HOME This example presents transferring file1.txt from our host to server2's user tom's home directory.
scp can also be used to transfer multiple files from one server to another. Below is example of transferring all files from my_folder directory with extension .txt to server2. In Below example all files will be transferred to user tom home directory. scp /my_folder/*.txt tom@server2:$HOME
To download a file from remote server to the local machine - type: scp tom@server2:$HOME/file.txt /local/machine/path/ This example shows how to download the file named file.txt from user tom's home directory to our local machine's current directory.
ps -e | less ps -e shows all the processes, its output is connected to the input of more via |, less paginates the results.
|& connects standard output and standard error of the first command to the second one while | only connects standard output of the first command to the second command. In this example, the page is downloaded via curl. with -v option curl writes some info on stderr including , the downloaded pag...

Page 765 of 1336