- Open Settings
- Switch to
Project/Python Interpreter/Install
- Click
MANGE REPOSITORIES
- Click
Add
- Enter
https://pypi.tuna.tsinghua.edu.cn/simple/
in popup - Save
This file contains hidden or 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
// with stl | |
int a[] = { 1, 2, 3, 4, 5 }; | |
int b[5]; | |
std::copy(std::begin(a),std::end(a),std::begin(b)); | |
for(auto e:b) cout << e << " "; // 1 2 3 4 5 | |
// array container (C++11) | |
std::array<int,5> arr = { 1, 2, 3, 4, 5 }; | |
std::array<int,5> copy; | |
copy = arr; |
This file contains hidden or 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
function isEqual(obj1, obj2) { | |
return JSON.stringify(obj1) === JSON.stringify(obj2); | |
} |
This file contains hidden or 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
// Reference: https://stackoverflow.com/questions/1527803/generating-random-whole-numbers-in-javascript-in-a-specific-range | |
/** | |
* Returns a random number between min (inclusive) and max (exclusive) | |
*/ | |
function getRandomArbitrary(min, max) { | |
return Math.random() * (max - min) + min; | |
} | |
/** | |
* Returns a random integer between min (inclusive) and max (inclusive). |
This file contains hidden or 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
echo "[archlinuxcn]" >> /etc/pacman.conf | |
echo "Server=https://mirrors.ustc.edu.cn/archlinuxcn/$arch" >> /etc/pacman.conf | |
sudo pacman -Sy | |
sudo pacman -S yaourt | |
sudo pacman -S archlinuxcn-keyring |
This file contains hidden or 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
# list available fonts | |
ls /usr/share/kbd/consolefonts | |
# try font | |
setfont lat2-10 | |
# persist font | |
## vim /etc/vconsole.conf | |
FONT=lat2-10 | |
## :wq |
This file contains hidden or 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
# add following lines in .vimrc | |
set visualbell | |
set noerrorbells | |
# or enter in command mode | |
:set visualbell | |
:set noerrorbells |
This file contains hidden or 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
# create service | |
mongod --dbpath "E:\MongoDB\data" --logpath "E:\MongoDB\log\logs.txt" --install --serviceName "MongoDB" | |
# delete service | |
mongod --remove --serviceName "MongoDB" | |
sc delete "MongoDB" |
This file contains hidden or 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
# container must run bash at first | |
docker run -it -d shykes/pybuilder /bin/bash | |
# use exec to run command | |
docker exec -it <container_id_or_name> echo "Hello from container!" |
This file contains hidden or 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
try: | |
# for Python 2.x | |
from StringIO import StringIO | |
except ImportError: | |
# for Python 3.x | |
from io import StringIO | |
import csv | |
scsv = """text,with,Polish,non-Latin,lettes | |
1,2,3,4,5,6 |