TL;DR::cmd (administrator) dir /AL /S C:\
Or dir /AL /S C:\ > junctions.txt
To print the output to a file. which is better.
Does Windows have symbolic links like Linux?
Yes. windows has symbolic links also called junctions. What are junctions? they are simply links to another location on a hard drive or network drive. The operating system and most programs will treat symbolic links like if they were actual folder. This is very useful when dealing with low disk space especially on pricey ssd (although these are getting cheaper) or eMMC on laptops. Some programs simply insist on storing their data on C application data. but they aren’t essential apps that need to run all the time. Things like Android studio or Netbeans. you may run one or the other most of the time. but still these programs store large amount of data.
Break down of the command:
DIR: list files and folders in current working directory or specified one.
AL: A switch is to display files with specific attributes such as hidden files, directories, read only. L attribute is for Junctions (Reparse Points)
S: means to include System files in the results.
> redirects output to a file.
How to test varnish configuration before loading
sudo varnishd -Cf /etc/varnish/default.vcl
To read an image directly from url and then reads its size. you can use urllib.request and PIL aka Pillow.
If you don’t have pillow installed. you can use:
python -m pip install Pillow
and before that you might need to upgrade pip, especially if you get an error
python -m pip install --upgrade pip
Here is how to read an image from url.
from PIL import Image
url = 'http://www.example.com/my_image_is_not_your_image.png'
image = Image.open(urllib.request.urlopen(url))
width, height = image.size
If you followed a tutorial that uses urllib2 you can change that to urllib.request in python 3.
When using print in python with some multibyte character or when decoding from another encoding you might encounter this fatal error:
Traceback (most recent call last):
File "skynet.py", line 28, in
UnicodeEncodeError: 'cp932' codec can't encode character '\xa1' in position 62: illegal multibyte sequence
To sort of fix it, you can use
This occurs because python can’t convert that character to the traditional windows ansi used in windows terminal (cmd). cp932 is code page 932 the Japanese version of shift-JIS.
Other encodings: cp874, cp936, cp949, cp950, cp1251, cp1252, cp1253, cp1254, cp1255, cp1256, cp1257, cp1258. Source
You simply use t and c flags followed by config file
sudo nginx -tc /etc/nginx/nginx.conf
This can give you output like this when ok:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
t flag according to man nginx means : Do not run, just test the configuration file. nginx checks the configuration file syntax and then tries to open files referenced in the configuration file.
c flag means: Use an alternative configuration file. the config file path should come after the c flag.
Why you should use this instead of restart? or reload? because when you do sudo service nginx restart and your config file is broken you’ll affect the whole server and if you have multiple websites that means all sites go down possibly because of some little curly boi ; . reload might not do anything when there is error. to be safe always test config before reloading or restarting. even if you do simple changes to main nginx config or sites configs.