-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
536 lines (424 loc) Β· 15.4 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
# shellcheck disable=SC2086
# Check if /bin/zsh is available or default to /bin/sh
ZSH_PATH := $(shell if [ -x /bin/zsh ]; then echo /bin/zsh; else echo /bin/bash; fi)
ZSH_PLUGINS := "$(shell cat install/ohmyzshfile)"
UBUNTU_PACKAGES = "$(shell cat install/ubuntu-packages.sh)"
OS := $(shell ./scripts/detect_os.sh)
.SILENT: symlinks
symlinks: ## Symlink files (draft)
@echo "WARNING: The 'symlinks' target is in draft state. Use 'init' instead."
for f in \.[^.]*; do \
FILE="$$(basename $$f)"; \
ln -vsf "$$PWD/$$FILE" "$$HOME"; \
done; \
init: ## Symlink files
# Backup directory for existing dotfiles
BACKUP_DIR := $(HOME)/dotfiles-backup
@mkdir -p $(BACKUP_DIR)
FILES_TO_SYMLINK := (
zsh/.zshrc \
zsh/.aliases \
zsh/.functions \
zsh/.exports \
zsh/.inputrc \
zsh/.dockerfunc \
git/.git-functions \
nvm \
.ignore \
.curlrc \
.psqlrc \
.sqliterc \
.pythonrc.py \
.ripgreprc \
# Git
git/.gitconfig \
git/.gitattributes \
git/.gitmessage \
git/.gitignore \
# Formatter
formatting/.prettierrc \
formatting/.eslintrc \
formatting/.prettierignore \
formatting/.eslintignore \
formatting/.editorconfig \
formatting/.stylelintrc \
# Node
.npmrc \
.nvmrc
)
@for file in $(FILES_TO_SYMLINK); do \
dest_file=$(HOME)/$$(basename $$file); \
if [ -e $$dest_file ]; then \
echo "Backing up $$dest_file to $(BACKUP_DIR)"; \
mv -v $$dest_file $(BACKUP_DIR)/; \
fi; \
ln -vsf $(PWD)/$$file $$dest_file; \
done
install:
set -e
clitools docker postgresql nginx node php python vscode zsh init
macinstall: ## macOS setup
# Check for Homebrew and install if we don't have it
@if test ! $(which brew); then \
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" \
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> $HOME/.zprofile \
eval "$(/opt/homebrew/bin/brew shellenv)" \
fi
# Update Homebrew
brew update
# Install all the dependencies with bundle (See Brewfile)
brew tap homebrew/bundle
brew tap homebrew/cask
brew tap homebrew/cask-drivers
brew bundle --file macos/Brewfile
android: ## Android sdk and tools
SDK_VERSION=29
wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip -P /home/${USER}
unzip /home/${USER}/sdk-tools-linux-4333796.zip -d /home/${USER}/Android/Sdk
rm /home/${USER}/sdk-tools-linux-4333796.zip
sudo apt-get install -y lib32z1 openjdk-8-jdk gradle
yes | /home/${USER}/Android/tools/bin/sdkmanager "platform-tools" "platforms;android-29" "build-tools;29.0.3"
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export PATH=$PATH:$JAVA_HOME/bin
export ANDROID_HOME=${HOME}/Android/Sdk
export PATH=${PATH}:${ANDROID_HOME}/tools
export PATH=${PATH}:${ANDROID_HOME}/emulator
export PATH=${PATH}:${ANDROID_HOME}/tools/bin
export PATH=${PATH}:${ANDROID_HOME}/platform-tools
linux: ## Install Ubuntu programms: flameshot, albert, spotify, dropbox, vlc, chrome, postman and update settings
# Installation is ment only for Linux distros
# Use local time
timedatectl set-local-rtc 1 --adjust-system-clock
# Show battery percentage
gsettings set org.gnome.desktop.interface show-battery-percentage true
# ALT + SHIFT change language
gsettings set org.gnome.desktop.input-sources xkb-options "['grp:alt_shift_toggle']"
# Enable minimize dock
gsettings set org.gnome.shell.extensions.dash-to-dock click-action 'minimize'
# enable numlock on startup
gsettings set org.gnome.desktop.peripherals.keyboard numlock-state true
# enable switch language with ALT + SHIFT
gsettings set org.gnome.desktop.input-sources xkb-options "['grp:alt_shift_toggle']"
sudo apt-get install -y \
ubuntu-restricted-extras \
filemanager-actions \
flameshot \
gnome-tweak-tool \
nautilus-dropbox \
vlc \
wine \
gedit-plugins
# install chrome
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -O google.deb
sudo dpkg -i google.deb
rm google.deb
# install albert
wget https://download.opensuse.org/repositories/home:/manuelschneid3r/xUbuntu_19.04/amd64/albert_0.16.1_amd64.deb -O albert.deb
sudo dpkg -i albert.deb
rm albert.deb
# Stacer
sudo apt install stacer -y
# Youtube DLL
sudo wget http://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl
sudo chmod a+rx /usr/local/bin/youtube-dl
# Snap packages
sudo snap install spotify postman slack --classic
# Video recorder
sudo add-apt-repository ppa:sylvain-pineau/kazam -y
sudo apt-get update -y
sudo apt install kazam -y
brew-linux: ## Brew package manager for Linux
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh
clitools: ## Install cli tools
@for pkg in $(UBUNTU_PACKAGES); do \
sudo apt-get install -y $$pkg || echo "Failed to install $$pkg"; \
done
# install bat cat replacement with syntax highlight
install_latest_release sharkdp/bat
# install autoenv. Load automatically .env files
wget --show-progress -o /dev/null -O- 'https://raw.githubusercontent.com/hyperupcall/autoenv/master/scripts/install.sh' | sh
# Better Git diff tool
install_latest_release dandavison/delta
# Smarter cd command, inspired by z and autojump
curl -sS https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | bash
# Fira code font
sudo apt install fonts-firacode
sudo fc-cache -fv
# Tidy-HTML5 format html in CLI
install_latest_release htacg/tidy-html5
# Vivid LS
wget "https://github.com/sharkdp/vivid/releases/download/v0.9.0/vivid_0.9.0_amd64.deb"
sudo dpkg -i vivid_0.9.0_amd64.deb
nvim: ## Neovim + Astrovim
cd ~
curl -LO https://github.com/neovim/neovim/releases/download/v0.9.1/nvim-linux64.deb
curl -LO https://github.com/neovim/neovim/releases/download/v0.9.1/nvim.appimage
sudo apt install ./nvim-linux64.deb
git clone https://github.com/AstroNvim/AstroNvim ~/.config/nvim
nvim +PackerSync
docker: ## Docker
sudo apt install apt-transport-https ca-certificates curl software-properties-common -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable" -y
sudo apt update
sudo apt install docker-ce -y
sudo usermod -aG docker ${USER}
su - ${USER}
id -nG
sudo groupadd docker
sudo gpasswd -a ${USER} docker
sudo service docker restart
# Docker compose
sudo curl -L "https://github.com/docker/compose/releases/download/2.16.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
# Docker utils
sudo apt-get install docker-ctop
mysql: ## Mysql
sudo apt-get update -y
sudo apt install mysql-server -y
sudo apt install mycli -y
# Create default mysql user
# start mysql
sudo /etc/init.d/mysql start
sudo mysql -e "CREATE USER '${USER}'@'localhost' IDENTIFIED BY '123456'";
sudo mysql -e "GRANT ALL PRIVILEGES ON * . * TO '${USER}'@'localhost'";
sudo mysql -e "FLUSH PRIVILEGES";
sudo /etc/init.d/mysql stop
mc: ## Midnight commander ( File manager in CLI )
sudo apt-get install mc -y
# Install dracula theme
mkdir ~/dracula-theme && cd ~/dracula-theme
git clone https://github.com/dracula/midnight-commander.git
mkdir -p ~/.local/share/mc/skins && cd ~/.local/share/mc/skins
ln -s ~/dracula-theme/midnight-commander/skins/dracula.ini
ln -s ~/dracula-theme/midnight-commander/skins/dracula256.ini
# edit ~/.config/mc/ini and add skin=dracula to the [Midnight-Commander] section..
# skin=dracula256
remove-mysql: ## Remove MySQL
sudo apt-get purge mysql mysql-server mysql-common mysql-client -y
# back up old databases
mv /var/lib/mysql /var/lib/mysql-bak
postgresql: ## PostgreSQL
sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install postgresql postgresql-contrib python3-psycopg2 libpq-dev
# Add the GPG key
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
sudo apt-get update -y
# Create base user
sudo -u postgres bash -c "psql -c \"CREATE ROLE ${USER} LOGIN SUPERUSER PASSWORD '123456';\""
# pgcli client
sudo apt-get install pgcli
remove-postgres: ## Completely deletes PostgreSQL
sudo apt-get --purge remove postgresql -y
sudo apt-get --purge remove postgresql-client-14 -y
sudo apt-get --purge remove postgresql-client-common -y
# remove remaining files
rm -rf /var/lib/postgresql/
rm -rf /var/log/postgresql/
rm -rf /etc/postgresql/
userdel -f postgres
mongodb: ## MongoDB
wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add -
echo "deb https://repo.mongodb.org/apt/ubuntu $(lsb_release -sc)/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list
sudo apt update -y
sudo apt install -y mongodb-org
sudo systemctl enable --now mongod
tesseract: ## Install Tesseract binaries
# installation: https://github.com/tesseract-ocr/tesseract/wiki/Compiling-%E2%80%93-GitInstallation
sudo add-apt-repository ppa:alex-p/tesseract-ocr-devel -y
sudo apt-get update -y
sudo apt-get install tesseract-ocr
sudo apt install libtesseract-dev
sudo apt-get install libpango1.0-dev libcurl4-gnutls-dev
# Languages
sudo apt-get install tesseract-ocr-eng
sudo apt-get install imagemagick make
# Libs
sudo apt-get install libicu-dev libpango1.0-dev libcairo2-dev
cd /usr/local/
mkdir tesseract-ocr && cd tesseract-ocr
git clone https://github.com/tesseract-ocr/tesseract
git clone https://github.com/tesseract-ocr/langdata_lstm
cd tesseract
./autogen.sh
./configure
make
make install
ldconfig
make training
make training-install
paddle-annotator: ## Paddle image annotation tool
# If you have cuda9 or cuda10 installed on your machine, please run the following command to install
# python3 -m pip install paddlepaddle-gpu -i https://mirror.baidu.com/pypi/simple
# If you only have cpu on your machine, please run the following command to install
python3 -m pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple
pip3 install PPOCRLabel
# Select label mode and run
# PPOCRLabel # [Normal mode] for [detection + recognition] labeling
# PPOCRLabel --kie True # [KIE mode] for [detection + recognition + keyword extraction] labeling
haskell: ## Install Haskell
sudo apt-get install -y haskell-platform
ruby: ## Install ruby and gems
sudo apt-get install ruby-full -y
gems=(
colorls
)
for gems in {gem[@]}; do
gem install ${gem} -y
done
java: ## Java JDK8
sudo apt-get update && sudo apt-get install openjdk-8-jdk -y
sudo apt-get install maven -y
dotnet: ## C#, Net core
wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
sudo apt-get update && sudo apt-get install -y dotnet-sdk-6.0
# Runtime
sudo apt-get update && sudo apt-get install -y aspnetcore-runtime-6.0
# Azure CLI
sudo curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
# Global packages
dotnet tool install -g dotnet-ef
# Dotnet Vscode extensions
cat vscode/dotnet.txt | xargs code --install-extension
elastic: ## ElastiSearch
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
sudo sh -c 'echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" > /etc/apt/sources.list.d/elastic-7.x.list'
sudo apt update -y
sudo apt install elasticsearch -y
sudo systemctl enable elasticsearch.service --now
go: ## Go lang
sudo apt-get install golang-go
export GOPATH="$HOME/Go"
export PATH="$PATH:/usr/local/go/bin:$GOPATH/bin"
ghcli: ## GitHub CLI
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key C99B11DEB97541F0
sudo apt-add-repository https://cli.github.com/packages
sudo apt update
sudo apt install gh
rust: ## Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
echo -e "source ${HOME}/.cargo/env" >> ${HOME}/.zshrc
# cargo packages
cargo install watchexec-cli
php: ## PHP8/Symfony, Apache
sudo apt-get install apache2 -y
# PHP8 Install
sudo apt-get update -y
sudo apt-get install -y php
# Extension
sudo apt-get install -y \
php8.1-mysql \
php8.1-curl \
php8.1-json \
php8.1-cgi \
php8.1-xsl \
php8.1-apcu \
php8.1-zip \
php8.1-gd \
php8.1-bcmath \
php8.1-xml \
php8.1-mbstring \
php8.1-intl \
php-odbc \
php-pgsql
php-zip
# PHP Unit testing
wget -O home/phpunit https://phar.phpunit.de/phpunit-8.phar
chmod +x phpunit
# PsySH
wget https://psysh.org/psysh
chmod +x psysh
# Composer install
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer -y
# XDEBUG
sudo apt-get install php8-xdebug -y
# Symfony
wget https://get.symfony.com/cli/installer -O - | bash
python3: ## Python,Poetry & Dependencies
sudo apt-get install -y \
curl \
python3-pip \
python3-venv \
python3-dev
# https://powerline.readthedocs.io/en/latest/installation.html#generic-requirements
pip3 install \
powerline-status \
virtualenv \
bpython \
ipdb \
icecream \
httpie \
faker \
litecli \
python3-pydrive \
--upgrade setuptools
python3 -m pip install --user pipx pylint black pipenv bandit mypy flake8
# Poetry dependency managment
curl -sSL https://install.python-poetry.org | python3 -
echo 'export PATH="${HOME}/.poetry/bin:${PATH}"' >> ~/.exports
# Python version manager
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.8.0
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
echo '. ${HOME}/.asdf/asdf.sh' >> ~/.zshrc
echo '. ${HOME}/.asdf/completions/asdf.bash' >> ~/.zshrc
vscode: ## VS Code - Linux
sudo snap install code --classic
nginx: ## Nginx
sudo add-apt-repository ppa:nginx/stable -y
sudo apt-get install nginx -y
node: ## NodeJS & packages
curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs
# NPM
mkdir ~/.npm-packages
npm config set prefix ~/.npm-packages
npm install -g npm@latest
sudo chown -R $USER ~/.npm-packages
sudo chown -R $USER /usr/local/lib/node_modules
# Yarn
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update && apt-get install yarn
# node version manager
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
# Node packages
npm install -g $(shell cat install/npmfile)
go-packages: ## Insall Go packages
go install -a $(shell cat install/gopackages)
ohmyzsh: ## Install zsh, oh-my-zsh & plugins
@if [ ! -z "$(which zsh --version)" ]; then \
echo "Installing zsh"; \
sudo apt-get install -y zsh \
sudo chsh -s $(which zsh); \
fi
sh -c "$$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
@for file in $(ZSH_PLUGINS); do \
repo=$$(basename $$file); \
dir=~/.oh-my-zsh/custom/plugins/$$repo; \
if [ ! -d $$dir ]; then \
git clone $$file $$dir; \
fi; \
done
latex: ## Install Latex & Pandoc
sudo apt-get install -y texlive pandoc
watchman: ## Install Watchman
cd ~
git clone https://github.com/facebook/watchman.git -b v4.9.0 --depth 1
cd watchman
./autogen.sh
./configure --enable-lenient
make
sudo make install
test: ## Test Makefile with Docker
docker build -t dotfiles .
docker run -it --name dotfiles -d dotfiles /bin/bash; \
docker exec -it dotfiles sh -c "cd dotfiles; make install"
docker rm -f dotfiles
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
| sort \
| awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.DEFAULT_GOAL := help