-
Notifications
You must be signed in to change notification settings - Fork 1
/
ubuntu-20.04-guide.txt
952 lines (774 loc) · 25.3 KB
/
ubuntu-20.04-guide.txt
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
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
############ PEPARE WINDOWS ####################
# Disable Bit Locker on Windows
-> Settings -> BitLocker -> Disable
# Switch to AHCI
1. boot windows
2. bcdedit /set {default} safeboot minimal
3. reboot, enter bios, set SATA to AHCI
4. contiune booting windows to safe mode
5. now windows will automatically enable AHCI drivers
6. bcdedit /deletevalue {default} safeboot
################################################
############# RESIZE NTFS ####################
# find devices
sudo -i
lsblk
# check existing partition
mount /dev/nvme0n1p3 /mnt
ls /mnt
umount /mnt
# resize NTFS file system
ntfsresize -n -i /dev/nvme0n1p3
ntfsresize -n -s 128G /dev/nvme0n1p3
ntfsresize -s 128G /dev/nvme0n1p3
# resize partition table itself
parted /dev/nvme0n1
print
rm 3
mkpart
"Basic data partition"
290MB
129GB
print
set 3 msftdata on
print
quit
# test new partition
mount /dev/nvme0n1p3 /mnt
ls /mnt
umount /mnt
# reboot into windows and check if it boots
reboot
###### IF BOOT FAILS
1. Prepare a live Windows stick
2. Verify partition is mounted on C: [by running Notepad and checking This PC]
3. Run commands
bootrec /fixboot
bcdboot c:\windows
4. hit "exit" and reboot, select "Windows on Volume 3"
5. After booting to windows, delete extra useless boot option
bcdedit
bcdedit /delete {blah blah blah}
bcdedit
6. reboot
################################################
INSTALLATION USING LUKS
################################################
sudo -i
lsblk
parted /dev/nvme0n1
print
mkpart primary 129GB 511GB
print
quit
### Or if clean install
parted /dev/sda
print
mkpart primary fat32 2M 512M
mkpart primary 512M 100%
print
set 1 esp on
set 1 boot on
label 1 "EFI system partition"
print
quit
mkfs.fat /dev/sda1
### END if clean install
lsblk
cryptsetup luksFormat --type=luks1 /dev/nvme0n1p5
cryptsetup luksOpen /dev/nvme0n1p5 enc
pvcreate /dev/mapper/enc
pvdisplay
vgcreate vg /dev/mapper/enc
vgdisplay
lvcreate -l 100%FREE -n root vg
lvdisplay
>>> Install using "Something Else"
>>> Enable Encrypted GRUB
# As soon as you have completed those forms switch to the Terminal to configure GRUB:
echo "GRUB_ENABLE_CRYPTODISK=y" >> /target/etc/default/grub
# This has to be done before the installer reaches the
# Install Bootloader stage at the end of the installation process.
>>> Post Installation
mount /dev/mapper/vg-root /target
for n in proc sys dev etc/resolv.conf; do mount --rbind /$n /target/$n; done
chroot /target
mount -a
apt install -y cryptsetup-initramfs
echo "KEYFILE_PATTERN=/etc/luks/*.keyfile" >> /etc/cryptsetup-initramfs/conf-hook
echo "UMASK=0077" >> /etc/initramfs-tools/initramfs.conf
mkdir /etc/luks
dd if=/dev/urandom of=/etc/luks/boot_os.keyfile bs=4096 count=1
chmod u=rx,go-rwx /etc/luks
chmod u=r,go-rwx /etc/luks/boot_os.keyfile
cryptsetup luksAddKey /dev/nvme0n1p5 /etc/luks/boot_os.keyfile
echo "enc UUID=$(blkid -s UUID -o value /dev/nvme0n1p5) /etc/luks/boot_os.keyfile luks,discard" >> /etc/crypttab
update-initramfs -u -k all
################################################
################################################
################################################
# change mirror to Main Server
Activities -> Software & Updates -> Ubuntu Software -> Download from: -> Main Server
# update system
sudo -i
apt update && apt -y upgrade && apt -y dist-upgrade && apt -y autoremove && do-release-upgrade
reboot
# install tools
sudo apt update && sudo apt install -y vim tmux screen htop psmisc wget xz-utils openssh-server ufw mlocate uuid-runtime tcpdump man-db traceroute w3m bridge-utils default-jdk git rar unrar iputils-arping network-manager-openvpn-gnome network-manager-openconnect-gnome iperf curl uget gnome-tweak-tool python3-pip p7zip-full p7zip net-tools pulseaudio pulseaudio-utils snapd clang wine winetricks xclip python3-venv gawk jq sshpass jsonnet whois ncat silversearcher-ag vim-nox gimp ctags aha nodejs git-secret dbus-tests cgroup-tools acpi mc x11vnc x11vnc xvfb fluxbox vim-gtk3 nautilus firefox gnome-terminal gnome-shell x11-apps gedit imagemagick
# clone notes
mkdir -p ~/Documents
cd Documents/
git clone https://github.com/arcana261/notes.git
cd notes
git submodule update --init --recursive
# setup RSA key
ssh-keygen -t rsa
# setup language
Settings -> Region and Language
-> Format: United States
-> Manage Installed Languages
-> Install/Remove Languages -> Persian
-> + -> Other -> Persian (with Persian keypad)
## reboot
## Tweaks -> Apperance -> Application -> Yaru-dark
## Tweaks -> Keyboard & Mouse -> Additional Layout Options -> Ctrl position -> Swap Ctrl and Caps Lock
## Settings -> Keyboard Shortcuts -> Switch to next input source -> Ctrl + Space
## Settings -> Keyboard Shortcuts -> Move to workspace above -> Ctrl + Alt + k
## Settings -> Keyboard Shortcuts -> Move to workspace blow -> Ctrl + Alt + j
## Settings -> Keyboard Shortcuts -> Close window -> Ctrl + Backspace
## Gedit -> colors -> solatized dark
## Setup VPN
## install chrome
-> Login
# setup python
python3 -m venv ~/.venv
source ~/.venv/bin/activate
pip install --upgrade pip
pip install wheel
pip install pysocks
pip install awscli
pip install pylint flake8 mypy
pip install msgpack
pip install jc
# create bash completion for pip
mkdir -p ~/.config/bash_completions
pip completion --bash > ~/.config/bash_completions/pip3
# update profile
mkdir -p ~/.local/{bin,lib,src,include,opt,tmp}
vim ~/.profile
............................
export PATH="$HOME/bin:$HOME/.local/bin:$PATH"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib:$HOME/.local/lib"
............................
# configure firewall
sudo systemctl enable ufw
sudo systemctl restart ufw
sudo ufw enable
# configure ssh
sudo vim /etc/ssh/sshd_config
...
Port 2122
PermitRootLogin no
...
sudo ufw reload
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow 2122/tcp
sudo ufw reload
sudo systemctl enable sshd
sudo systemctl restart sshd
# enable upnp
sudo ufw reload
sudo ufw allow 1900/udp
sudo ufw reload
# configure sysctl
sudo vim /etc/sysctl.conf
..........................................
fs.inotify.max_user_watches = 524288
..........................................
# reload sysctl
sudo sysctl -p --system
# set default editor to vim.nox
sudo update-alternatives --config editor
# install other restricted areas
sudo apt install -y ubuntu-restricted-extras
# install smplayer
sudo apt install -y smplayer
# install mplayer2
sudo apt install -y mplayer
# install vlc
sudo apt install -y vlc vlc-data
# configure git
git config --global user.name "Mohamadmehdi Kharatizadeh"
git config --global user.email "[email protected]"
git config --global credential.helper store
vim ~/.git-credentials
...........................................
https://arcana261:[email protected]
...........................................
## install SSH public key to github
# install samba server
sudo apt -y install samba samba-common
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.org
# create shared folder configuration
mkdir -p ~/.local/share
sudo vim /etc/samba/smb.conf
.....
[global]
map to guest = bad user
[junk]
comment = share
path = /home/arcana/.local/share
browsable = yes
writable = yes
guest ok = yes
read only = no
force user = arcana
force group = arcana
.....
# enable and restart samba service
sudo systemctl restart smbd
sudo systemctl enable smbd
sudo systemctl status smbd
# allow ports through firewall
sudo ufw reload
sudo ufw allow 139/tcp
sudo ufw allow 445/tcp
sudo ufw reload
## Install Docker
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker
## Install extended tmux conf from Notes!
vim ~/.tmux.conf
..........................
source-file $HOME/Documents/notes/sysconfig/tmux.conf
..........................
## Install extended bashrc from Notes!
vim ~/.bashrc
..........................
source $HOME/Documents/notes/sysconfig/bashrc.sh
..........................
## reboot and start using tmux
## setup new vim
nvim
# setup dns resolver
sudo vim /etc/systemd/resolved.conf
..........................
DNS=4.2.2.4 8.8.8.8
Domains=~
..........................
sudo systemctl restart systemd-resolved.service
# flush dns
systemd-resolve --flush-caches
# view dns resolver status
systemd-resolve --status
## Install fuzzy finder
mkdir -p ~/.local/src
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.local/src/fzf
~/.local/src/fzf/install
## install up from
## https://github.com/akavel/up
## install it to $HOME/.local/bin
## Install go
tar -C ~/.local -xzf golang.tar.gz
rm -f golang.tar.gz
vim ~/.profile
....................................
export GOPATH=$HOME/go
export GOROOT=$HOME/.local/go
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOROOT/bin:$GOBIN
....................................
# reboot
sudo reboot
## Install VIM plugins
mkdir -p ~/.vim/pack/vendor/start
# install nerdtree
git clone --depth 1 https://github.com/preservim/nerdtree.git ~/.vim/pack/vendor/start/nerdtree
git clone --depth 1 https://github.com/ciaranm/detectindent.git ~/.vim/pack/vendor/start/detectindent
# install ale
mkdir -p ~/.vim/pack/git-plugins/start
git clone --depth 1 https://github.com/dense-analysis/ale.git ~/.vim/pack/git-plugins/start/ale
# install fzf
mkdir -p ~/.vim/pack/git-plugins/start
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.vim/pack/git-plugins/start/fzf
git clone --depth 1 https://github.com/junegunn/fzf.vim.git ~/.vim/pack/git-plugins/start/fzf.vim
# install deoplete
mkdir -p ~/.vim/pack/git-plugins/start
git clone --depth 1 https://github.com/roxma/nvim-yarp.git ~/.vim/pack/git-plugins/start/nvim-yarp
git clone --depth 1 https://github.com/roxma/vim-hug-neovim-rpc.git ~/.vim/pack/git-plugins/start/vim-hug-neovim-rpc
git clone --depth 1 https://github.com/Shougo/deoplete.nvim.git ~/.vim/pack/git-plugins/start/deoplete
source ~/.venv/bin/activate
pip install pynvim
# install theme
mkdir -p ~/.vim/pack/git-plugins/start
git clone --depth 1 https://github.com/mhartington/oceanic-next.git ~/.vim/pack/git-plugins/start/oceanic-next
# install airline
mkdir -p ~/.vim/pack/git-plugins/start
git clone --depth 1 https://github.com/vim-airline/vim-airline.git ~/.vim/pack/git-plugins/start/vim-airline
# install fugitive.vim
mkdir -p ~/.vim/pack/git-plugins/start
git clone --depth 1 https://github.com/tpope/vim-fugitive.git ~/.vim/pack/git-plugins/start/vim-fugitive
# install vimspector
mkdir -p ~/.vim/pack/git-plugins/start
git clone https://github.com/puremourning/vimspector ~/.vim/pack/vimspector/opt/vimspector
~/.vim/pack/vimspector/opt/vimspector/install_gadget.py --all --disable-tcl
# install deoplete-go
go get -u -v github.com/stamblerre/gocode
mkdir -p ~/.vim/pack/git-plugins/start
git clone --depth 1 https://github.com/deoplete-plugins/deoplete-go.git ~/.vim/pack/git-plugins/start/deoplete-go
(cd ~/.vim/pack/git-plugins/start/deoplete-go && make)
# install vim-jsonnet
mkdir -p ~/.vim/pack/git-plugins/start
git clone --depth 1 https://github.com/google/vim-jsonnet.git ~/.vim/pack/git-plugins/start/vim-jsonnet
# install go-langserver for ALE
go get -v -u github.com/sourcegraph/go-langserver
# install vim indent guide plugin
mkdir -p ~/.vim/pack/git-plugins/start
git clone --depth 1 https://github.com/nathanaelkane/vim-indent-guides.git ~/.vim/pack/git-plugins/start/vim-indent-guides
# install vim quickfix toggle plugin
mkdir -p ~/.vim/pack/git-plugins/start
git clone --depth 1 https://github.com/milkypostman/vim-togglelist.git ~/.vim/pack/git-plugins/start/vim-togglelist
# install vim tmuxline plugin
mkdir -p ~/.vim/pack/git-plugins/start
git clone --depth 1 https://github.com/edkolev/tmuxline.vim.git ~/.vim/pack/git-plugins/start/tmuxline
# install tagbar plugin
mkdir -p ~/.vim/pack/git-plugins/start
git clone --depth 1 https://github.com/majutsushi/tagbar.git ~/.vim/pack/git-plugins/start/tagbar
# install vim notes plugin
mkdir -p ~/.vim/pack/git-plugins/start
git clone --depth 1 https://github.com/xolox/vim-notes.git ~/.vim/pack/git-plugins/start/vim-notes
# install vim misc plugin
mkdir -p ~/.vim/pack/git-plugins/start
git clone --depth 1 https://github.com/xolox/vim-misc.git ~/.vim/pack/git-plugins/start/vim-misc
# install pathogen
mkdir -p ~/.vim/autoload ~/.vim/bundle
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
# install vim-javacomplete2
mkdir -p ~/.vim/pack/git-plugins/start
git clone --depth 1 https://github.com/artur-shaik/vim-javacomplete2.git ~/.vim/pack/git-plugins/start/vim-javacomplete2
# install vim ultisnips
mkdir -p ~/.vim/pack/git-plugins/start
git clone --depth 1 https://github.com/SirVer/ultisnips.git ~/.vim/pack/git-plugins/start/ultisnips
mkdir -p ~/.vim/UltiSnips/
vim ~/.vim/UltiSnips/java.snippets
.....................................................
priority 10
# System.out.println();
snippet sout "System.out.println();" bA
System.out.println($0);
endsnippet
snippet br "break" bA
break;
endsnippet
snippet cs "case" b
case $1:
$2
$0
endsnippet
snippet ca "catch" b
catch (${1:Exception} ${2:e})`!p nl(snip)`{
$0
}
endsnippet
# Main method for Java Class
snippet main "public static void main()" bA
public static void main (String[] args){
$0
}
endsnippet
# if statement
snippet if "If this then that" bA
if ($1){
$2
}
$3
endsnippet
# Else if statement
snippet elif "else if this then that" bA
else if ($1){
$2
}
$3
endsnippet
snippet for "for(int i; i < imax; i++)" bA
for ($1; $2; $3){
$4
}
endsnippet
.....................................................
# install vim-plug
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
# create a good vimrc
vim ~/.vimrc
.................
source $HOME/Documents/notes/sysconfig/vimrc.vim
.................
# install plug plugins
vim
....................
:PlugInstall
....................
## re-start vim and enjoy!
## Disable swap
# find swap
cat /etc/fstab
# turn it off
sudo swapoff /swapfile
# remove entry from fstab
sudo vim /etc/fstab
[x] .................
/swapfile .........
.................
# remove swap file
sudo rm -f /swapfile
## Install protoc from guide
sudo apt install libprotoc-dev protobuf-compiler
## Install Slack
## Install Extensions
Drop Down Terminal
-> Hotkey: F1
-> Height: 100%
-> Transparency: 100
Persian Calendar
## Autohide dock
Settings -> Apperance -> Autohide dock
## Install Kubectl
# create bash completion for kubectl
mkdir -p ~/.config/bash_completions
kubectl completion bash > ~/.config/bash_completions/kubectl
## Configure Ocean Keys
## Install it as `~/.kube/config`
## Install discord
## -> F10 -> Toggle Mute
## Install VsCode
-> Python
-> Go
->> Go: Install or update tools
-> Git Blame
-> Diff
-> Vim
-> Docker
-> ES7 React/Redux/GraphQL/React-Native
## Rebuild whois cache
cd ~/Documents/notes/awk/whois
./rebuild-from-cache.sh
## Fix ir routes
## NOTE: set device link name in ~/.bashrc
## as
## export IR_LINK_NAME="wlp2s0b1"
fix-ir-routes
## Install skype
## Configure Dual Monitor
## Configure Sound Settings
## Install Telepresence
# Better config SSH
vim ~/.ssh/config
................................
Host *
StrictHostKeyChecking no
................................
chmod 600 ~/.ssh/config
# Configure my server's SSH
vim ~/.ssh/config
................................
Host ucoder
Hostname www.ucoder.ir
Port xxxx
User xxxx
................................
ssh-copy-id ucoder
## Import gpg key
gpg --import Downloads/gpg.asc
...................... SETUP GIT ............................................
git config --global --unset gpg.format
gpg --list-secret-keys --keyid-format=long
$ gpg --list-secret-keys --keyid-format=long
/Users/hubot/.gnupg/secring.gpg
------------------------------------
sec 4096R/3AA5C34371567BD2 2016-03-10 [expires: 2017-03-10]
uid Hubot <[email protected]>
ssb 4096R/4BB6D45482678BE3 2016-03-10
git config --global user.signingkey 3AA5C34371567BD2
git config --global commit.gpgsign true
[ -f ~/.bashrc ] && echo -e '\nexport GPG_TTY=$(tty)' >> ~/.bashrc
.................... ENV SETUP GIT ..........................................
## Configure ocean SSH
ocean
machine
## Configure AWS keys
mkdir -p ~/.aws
vim ~/.aws/credentials
..............................
[name]
aws_access_key_id=xxxxxxxxxxxxxx
aws_secret_access_key=xxxxxxxxxxxxx
..............................
## Install Youtube Music
## Add youtube music to favorites
## Put it below firefox
## Change Wallpaper
## Change Avatar
## Install MineCraft Client
....................................
ln -s /home/arcana/.minecraft/screenshots /home/arcana/Pictures/minecraft-screenshots
ln -s /home/arcana/.minecraft/backups /home/arcana/Documents/minecraft-backups
....................................
## Install OBS Studio
## Install OpenShot
## Configure SSH/VPN for
-> DBS
## Remove `Help` from favorites
## Add chrome to favorites
## Put chrome below firefox
## Install Charles Proxy
## Install wireshark
sudo apt install wireshark
## install pg_config
sudo apt install libpq-dev
## install `stern` from
## https://github.com/wercker/stern
## to ~/.local/bin
## Update kernel to latest
## Install the `lowlatency` kernel
## from http://kernel.ubuntu.com/~kernel-ppa/mainline/
## Install delve from
## go get github.com/go-delve/delve/cmd/dlv
## Install helm
sudo snap install helm --classic
## Remove thunderbird from favorites
## Setup python2
sudo apt install python2
curl https://bootstrap.pypa.io/get-pip.py --output ~/.cache/get-pip.py
sudo python2 ~/.cache/get-pip.py
rm -f ~/.cache/get-pip.py
## Install fluxbox
sudo apt install fluxbox arandr ibus ibus-m17n network-manager alsa-utils \
alsamixergui gstreamer1.0-alsa pavucontrol libasound2-plugin-equal \
pulsemixer python-dbus
##
## >> login to fluxbox
##
## Configure fluxbox
mkdir -p ~/.fluxbox
echo "[begin] (fluxbox)" > ~/.fluxbox/menu
echo "[include] (/etc/X11/fluxbox/fluxbox-menu)" >> ~/.fluxbox/menu
echo "[submenu] (Keyboards)" >> ~/.fluxbox/menu
echo "[exec] (us) {setxkbmap us}" >> ~/.fluxbox/menu
echo "[exec] (ir) {setxkbmap ir}" >> ~/.fluxbox/menu
echo "[end]" >> ~/.fluxbox/menu
##
## >> re-login to fluxbox
##
x-start-ibus
ibus -> preferences -> input method -> add -> persian
-> general -> next input method -> <Control>space
## configure GITLAB_CI_USERNAME and GITLAB_CI_TOKEN in ~/.bashrc
## fix apple sound
## from https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/sound/pci/hda
## look for (models) inside patch files
sudo vim /etc/modprobe.d/alsa-base.conf
....................................................
options snd-hda-intel model=auto
....................................................
sudo alsa force-reload
## Mix left and right channels into left channel
vim ~/.asoundrc
....................................................
pcm.!default {
type plug
slave.pcm {
type asym
playback.pcm {
type route
slave.pcm plugequal
ttable.0.0 0.66
ttable.0.1 0.33
ttable.1.0 0.33
ttable.1.1 0.66
}
capture.pcm "hw:0"
}
}
ctl.!default {
type hw card 0
}
ctl.equal {
type equal;
}
pcm.plugequal {
type equal;
slave.pcm "plughw:0,0";
}
pcm.equal {
type plug;
slave.pcm plugequal;
}
....................................................
sudo alsa force-reload
alsactl kill rescan
sudo alsactl nrestore
## create monitor profiles
## create following
> dual-extended-external-primary-left.sh
> dual-extended-external-primary-right.sh
> dual-extended-internal-primary-left.sh
> dual-extended-internal-primary-right.sh
> external-only.sh
> internal-only.sh
arandr
## login chrome into gmail
## login firefox
## login firefox into gmail
## install (scrum for trello) in firefox
## setup whats app web
## setup telegram web
## set firefox and vim memory limit
## value is example only
vim ~/.config/resources.bashrc
................................................
export FIREFOX_MEMORY_LIMIT="1600m"
export FIREFOX_SHM_LIMIT="250m"
export VIM_MEMORY_LIMIT="500m"
export VIM_SHM_LIMIT="30m"
export LINUX_MEMORY_LIMIT="150m"
export LINUX_SHM_LIMIT="30m"
export GLASSFISH_MEMORY_LIMIT="660m"
export GLASSFISH_SHM_LIMIT="30m"
................................................
>> gnome-control-center
## login in to `Google` and `Microsoft`
## Add youtube music to firefox bookmark toolbar
## install vim vixen for firefox
-> properties -> colorscheme -> dark
## setup glassfish server
# download glassfish from https://javaee.github.io/glassfish/download
# put it temporarily in ~/Downloads/
build-glassfish
# delete after build is done
## install octave
sudo apt install -y octave
## install some more utilities
sudo snap install --classic duf-utility bottom
## setup imagemagick and PDF by commenting out the policy
## <policy domain="coder" rights="none" pattern="PDF" />
##
## also REMOVE the following lines / comment them
##
## <!-- disable ghostscript format types -->
## <policy domain="coder" rights="none" pattern="PS" />
## <policy domain="coder" rights="none" pattern="PS2" />
## <policy domain="coder" rights="none" pattern="PS3" />
## <policy domain="coder" rights="none" pattern="EPS" />
## <policy domain="coder" rights="none" pattern="PDF" />
## <policy domain="coder" rights="none" pattern="XPS" />
sudo vim /etc/ImageMagick-6/policy.xml
=====================================================================================================
=====================================================================================================
=====================================================================================================
=====================================================================================================
=====================================================================================================
# cat to a file
cat >myfile.txt <<EOL
some blah
EOL
# give multiline input
grpcurl -d @ grpc.server.com:443 my.custom.server.Service/Method <<EOM
{
"id": 1234,
"tags": [
"foor",
"bar"
]
}
EOM
# read multiline from file
while IFS='' read -r line || [ -n "${line}" ]; do
...
done < $QUOROM_QUEUE_STATS
## create iso from cd/dvd
# find block size
isoinfo -d -i /dev/cdrom | grep -i -E 'block size|volume size'
# start copying iso
dd if=/dev/cdrom of=test.iso bs=<block size from above> count=<volume size from above>
# send progress signal from another terminal
watch -n 1 killall -USR1 dd
## create usb flash drive from iso
sudo dd bs=4M if=input.iso of=/dev/sd<?> conv=fdatasync
sync
sudo sync
# send progress signal from another terminal
sudo watch -n 1 killall -USR1 dd
=====================================================================================================
=====================================================================================================
=====================================================================================================
vimspector important notes
=====================================================================================================
=====================================================================================================
F5 When debugging, continue. Otherwise start debugging. vimspector#Continue()
F3 Stop debugging. vimspector#Stop()
F4 Restart debugging with the same configuration. vimspector#Restart()
F6 Pause debugee. vimspector#Pause()
F9 Toggle line breakpoint on the current line. vimspector#ToggleBreakpoint()
<leader>F9 Toggle conditional line breakpoint on the current line. vimspector#ToggleBreakpoint( { trigger expr, hit count expr } )
F8 Add a function breakpoint for the expression under cursor vimspector#AddFunctionBreakpoint( '<cexpr>' )
F10 Step Over vimspector#StepOver()
F11 Step Into vimspector#StepInto()
F12 Step out of current function scope vimspector#StepOut()
${dollar} - has the value $, can be used to enter a literal dollar
$$ - a literal dollar
${workspaceRoot} - the path of the folder where .vimspector.json was found
${workspaceFolder} - the path of the folder where .vimspector.json was found
${gadgetDir} - path to the OS-specifc gadget dir (<vimspector home>/gadgets/<OS>)
${file} - the current opened file
${relativeFile} - the current opened file relative to workspaceRoot
${fileBasename} - the current opened file’s basename
${fileBasenameNoExtension} - the current opened file’s basename with no file extension
${fileDirname} - the current opened file’s dirname
${fileExtname} - the current opened file’s extension
${cwd} - the current working directory of the active window on launch
## Python Remote Debug with `debugpy`
## python -m debugpy --listen 0.0.0.0:5678 program.py
## python -m debugpy --listen 0.0.0.0:5678 -m module
## .vimspector.json
{
"configurations": {
"Python Attach": {
"adapter": "multi-session",
"configuration": {
"request": "attach",
"justMyCode": false,
"pathMappings": [
{
"localRoot": "${workspaceRoot}",
"remoteRoot": "."
}
]
}
}
}
}
## Go Remote Debug with 'dlv'
## dlv debug --headless --listen 0.0.0.0:5678
## .vimspector.json
{
"configurations": {
"run": {
"adapter": "vscode-go",
"configuration": {
"request": "launch",
"program": "${fileDirname}",
"mode": "debug",
"dlvToolPath": "$HOME/go/bin/dlv"
},
"breakpoints": {
"exception": {
"caught": "N",
"uncaught": "N"
}
}
}
}
}