- Keyboard Shortcuts
- Useful Shortcuts
- vim
- Terminal
- Add User
- Install Terminalizer (Terminal Recorder)
- Using Terminalizer
- SSH
- Install Synergy
- Screen
- FFmpeg - youtube-dl
- nmap
- Install Offline Package
- Conda
- Git
- Python
- nohup
- Add User Non-Interactive
- Delete User
- jq Json Parser
- Ubuntu 18.04 Beats Studio 3 Bluetooth Connection Problem
- Install minikube
- Install kubectl
- Copy to Clipboard
- Crontab
- Copy and Preserve Existing File
- Add Swap Memory
- Install Nvidia Driver
- Change username, group and home directory
- Ubuntu Post Install
- Logitech M560 Buttons
- Ubuntu Install Freeze
- Error Installing Ubuntu
- Move Gitlab issues Bulk to Another Project
- Assign Static IP Adress
- OpenCV
- gdown download from google drive
- Reload Nvidia Kernel
- Git Clone with Specific SSH Key
- WSL 2
- nginx File Server
- Oracle Database 11g
- Name = screenshot_grab
Command =Not Working on Ubuntu 20.04gnome-screenshot -a -c
- Command =
/home/fatih/ss.sh
- Shortcut = F4
ss.sh
#!/bin/bash
gnome-screenshot -acf /tmp/test && cat /tmp/test | xclip -i -selection clipboard -target image/png
or
Change Copy a screenshot of an area to clipboard
to F4
- Name = spotify_play_pause
- Command =
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause
- Shortcut = SHIFT + 5 (Numpad)
- Name = spotify_next
- Command =
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next
- Shortcut = SHIFT + 6 (Numpad)
- Name = spotify_prev
- Command =
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous
- Shortcut = SHIFT + 4 (Numpad)
Open Terminal in current Directory = Shift + F10 + e
dw
: Deletes one word/token. Also very useful to remove indenting in source code.
cd -
: Move back into the most recent directory
sudo !!
: runs the previous command as sudo.
CTRL + Z
: Pauses an application
fg
: Returns you to the application
xdg-open
: Opens a file
grep -A3 -B7 <PATTERN>
: include 3 line After the match and include 7 lines Before the match
$ sudo adduser <username>
$ sudo passwd <username>
$ sudo usermod -aG docker <username>
# Give sudo priviliges
$ sudo usermod -aG wheel username
$ curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - && sudo apt install nodejs
$ sudo npm install -g terminalizer --unsafe-perm=true --allow-root
error while loading shared libraries: libgconf-2.so.4: cannot open shared object file: No such file or directory Solution:
sudo apt-get install libgconf-2-4
First time:
$ terminalizer init
$ cd ~/.terminalizer && wget https://gist.githubusercontent.com/fatihbaltaci/9692cf265949d63953fe7cd7ac8b6549/raw/8092b2d94277c70a30b680f9f2191b6cc7e295a0/config.yml -O config.yml
$ terminalizer record redial_add
$ sudo terminalizer render redial_add
$ ssh-copy-id -i id_rsa.pub <username>@<server_ip>
$ ssh -D <PORT> <USERNAME>@<HOSTNAME>
- List process:
$ netstat -tlpn | grep ssh
~/.ssh/config
Host bitbucket_personal
HostName bitbucket.org
IdentityFile ~/.ssh/id_rsa
Host bitbucket_work
HostName bitbucket.org
IdentityFile ~/.ssh/id_rsa_work
- Clone. Change
bitbucket.org
withbitbucket_work
git clone git@bitbucket_work:company/repo.git
$ sudo apt install synergy=1.8.8-stable+dfsg.1-1build1
$ screen -S <session_name>
Ctrl+a d
$ screen -ls
$ screen -r <session_id>
- Attach screen session
- Press
Ctrl
+A
then type:quit
-ss
: start timestamp (HH:MM:SS.xxx)
-t
: encoding duration (HH:MM:SS.xxx)
$ ffmpeg -ss 00:00:00 -i not_stable_video.avi -c copy -t 00:00:03 not_stable_video_splitted.avi
$ ffmpeg -re -stream_loop -1 -i video.mp4 -vcodec h264 -f mpegts udp://localhost:1414
- Open VLC:
VLC -> Media -> Open Network Stream -> Network
URL:
udp://@localhost:1414
$ ffmpeg -i video.mp4 frame%d.png
ffprobe -show_data -hide_banner video.mp4
ffmpeg -i rtsp://... -vcodec copy out.mp4
Credit (Ahmet Alp Balkan): https://www.youtube.com/watch?v=6BV7TaDSu0Q
youtube-dl <VIDEO_URL> -o- | ffmpeg -i /dev/stdin -f mp3 -ab 96000 -vn - > out.mp3
youtube-dl <VIDEO_URL> -o- | vlc -
or
vlc <VIDEO_URL>
$ nmap -v -A <URL>
$ nmap -sP 192.168.2.1/24
Install .deb
files offline.
- Remove apt caches
$ sudo rm -rf /var/cache/apt/archives/*
- Download package
$ sudo apt-get install wireshark
# ls /var/cache/apt/archives/
libc-ares2_1.14.0-1_amd64.deb libwireshark11_2.6.10-1~ubuntu18.04.0_amd64.deb lock
libmaxminddb0_1.3.1-1_amd64.deb libwireshark-data_2.6.10-1~ubuntu18.04.0_all.deb partial
libnl-route-3-200_3.2.29-0ubuntu3_amd64.deb libwiretap8_2.6.10-1~ubuntu18.04.0_amd64.deb wireshark_2.6.10-1~ubuntu18.04.0_amd64.deb
libsmi2ldbl_0.4.8+dfsg2-15_amd64.deb libwscodecs2_2.6.10-1~ubuntu18.04.0_amd64.deb wireshark-common_2.6.10-1~ubuntu18.04.0_amd64.deb
libspandsp2_0.0.6+dfsg-0.1_amd64.deb libwsutil9_2.6.10-1~ubuntu18.04.0_amd64.deb wireshark-qt_2.6.10-1~ubuntu18.04.0_amd64.deb
Dependencies are shown in /var/cache/apt/archives/
.
- Zip dependencies
$ cd /var/cache/apt/archives/ && sudo zip wireshark_deb.zip *
- Move
wireshark_deb.zip
to offline machine. - Unzip it to
/var/cache/apt/archives/
- Install the package with dpkg
$ sudo dpkg -i wireshark_2.6.10-1~ubuntu18.04.0_amd64.deb
- This will give an error with missing dependencies. apt-get can fix these problems
$ sudo apt-get -f install
- Package is installed
- Activate
$ conda activate yolov3
- Export
$ conda env export > conda_yolov3.yml
git remote show origin
git remote -v
git config user.email "[email protected]"
git config user.name "Fatih Baltacı"
git config --global user.email "[email protected]"
git config --global user.name "Fatih Baltacı"
git branch -d <branch_name>
git push origin --delete <branch_name>
python -m cProfile test.py
import cProfile
cProfile.run('foo()')
sudo apt install python3.7
nohup <COMMAND> > output.txt 2>&1 &
#!/bin/bash
for USERNAME in user1 user2 user3
do
sudo adduser $USERNAME
echo 123 | sudo passwd $USERNAME --stdin
sudo usermod -aG docker $USERNAME
done
- Without home directory
sudo userdel <username>
- With home directory
sudo userdel -r <username>
https://stedolan.github.io/jq/
sudo apt-get install jq
- Install blueman
sudo apt-get install blueman
https://forum.manjaro.org/t/pair-wireless-bluetooth-headphones-beats-solo-3/41032/4
- Change:
sudo touch /etc/bluetooth/audio.conf
Add these lines inside. Do not change anything. The order is important.
[General]
Disable=Socket
Disable=Headset
Enable=Media,Source,Sink,Gateway
AutoConnect=true
load-module module-switch-on-connect
Now you will have to edit the file /etc/bluetooth/main.conf. Change the contents to this.
### Restricts all controllers to the specified transport. Default value
## #is "dual", i.e. both BR/EDR and LE enabled (when supported by the HW).
## #Possible values: "dual", "bredr", "le"
ControllerMode = bredr
If you have just one Bluetooth toggle and you switch from computer all the time, change this line too. Change the code to this.
#AutoEnable defines option to enable all controllers when they are found.
#This includes adapters present on start as well as adapters that are plugged
#in later on. Defaults to 'false'.
AutoEnable=true
- Restart bluetooth service
sudo service bluetooth restart
- Connect using blueman
- Pair
- Audio Sink
- Exit blueman To prevent Glitch problem, close settings and bluetoohctl tool.
https://minikube.sigs.k8s.io/docs/start/linux/
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 \
&& sudo install minikube-linux-amd64 /usr/local/bin/minikube
sudo minikube start --vm-driver=none
https://kubernetes.io/docs/tasks/tools/install-kubectl/
curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl && chmod +x ./kubectl && sudo mv ./kubectl /usr/local/bin/kubectl
Get pods
kubectl get po -A
sudo apt install xclip
# copy
echo "fatih" | xclip -selection clipboard
#paste
xclip -selection clipboard -o
/etc/crontab
# every hour
0 0 * ? * * * fatih cd /home/fatih && bash docker_files_run.sh
file1.txt -> file1.txt file1.txt.orig
cp --backup --suffix=.orig file1.txt /file/path
https://www.cloudbooklet.com/how-to-add-swap-space-on-ubuntu-18-04-google-cloud/
sudo swapon --show
sudo fallocate -l 4G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
# Making the Swap File Permanent
sudo vi /etc/fstab
# Add
/swapfile swap swap defaults 0 0
sudo mount -a
https://linuxize.com/post/how-to-add-swap-space-on-centos-7/
sudo swapon --show
sudo dd if=/dev/zero of=/swapfile count=4096 bs=1MiB
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
# Making the Swap File Permanent
sudo vi /etc/fstab
# Add
/swapfile swap swap defaults 0 0
sudo mount -a
https://www.cyberciti.biz/faq/ubuntu-linux-install-nvidia-driver-latest-proprietary-driver/
sudo apt search nvidia-driver
sudo apt install nvidia-driver-430
- Download driver: https://www.nvidia.com.tr/drivers/results/158186#driverInfo-158186=0
sudo rpm -i nvidia-driver-local-repo-rhel7-440.64.00-1.0-1.x86_64.rpm
sudo yum clean all
sudo yum install cuda-drivers
sudo reboot
NEW_USERNAME=new_user
OLD_USERNAME=old_user
sudo usermod -l $NEW_USERNAME $OLD_USERNAME
sudo groupmod -n $NEW_USERNAME $OLD_USERNAME
sudo usermod -d /home/$NEW_USERNAME -m $NEW_USERNAME
#!/bin/bash
sudo apt update && \
sudo apt upgrade -y && \
sudo apt install -y openssh-server vim htop curl wget zip unzip && \
curl -fsSL https://get.docker.com -o get-docker.sh && sudo sh get-docker.sh && \
distribution=$(. /etc/os-release;echo $ID$VERSION_ID) && \
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - && \
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list && \
sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit && \
sudo systemctl restart docker && \
sudo apt-get install -y nvidia-container-runtime && \
sudo echo `curl -s -I https://gist.githubusercontent.com/fatihbaltaci/025b35a0563f2eff3713ba333e3f0218/raw/192c98650d7f5be8758309239df29372b851d3a1/default_nvidia_runtime.txt` > /etc/docker/daemon.json
sudo pkill -SIGHUP dockerd && \
sudo systemctl restart docker
https://mehmethanoglu.com.tr/tips/16-logitech-mouse-m560-ileri-ve-geri-butonlari.html
sudo apt-get install imwheel
imwheel -k -b "0 0 0 0 11 10"
https://askubuntu.com/a/870245/1074472
Then choose the Ubuntu, or Install Ubuntu (it depends, you will see it hopefully), go to it with the arrows and press the 'e' key.
Here go to the line which contains quiet splash at the end and add acpi=off after these words.
Then press F10 to boot with these settings.
initramfs unable to find a medium containing a live file system
- Enable CSB (Legacy)
- Disable Fast Boot
https://gitlab.com/gitlab-org/gitlab/-/issues/2102#note_347630681
var fakeRun = true; // set to FALSE to actually run it; this way, you can check the url and params before actually doing it
var baseUrl = "https://gitlab.com/"; // TODO replace with your url
var targetProjectId = 0000001; // TODO replace with your target project id
var time = 500;
jQuery(".issues-list > li").each(function (index, element) {
setTimeout(function () {
var relativeUrl = jQuery(element).attr('url');
var data = {move_to_project_id: targetProjectId};
var url = baseUrl + relativeUrl + "/move";
console.log('POSTING TO ' + url + ' with ' + JSON.stringify(data));
if (!fakeRun) {
$.ajax({
type: "POST",
url: url,
data: data,
success: function () {
console.log('OK');
}
});
}
}, time);
time += 800;
});
sudo vi /etc/sysconfig/network-scripts/ifcfg-eth0
sudo systemctl restart network
- /etc/netplan/00....yaml
# Let NetworkManager manage all devices on this system
network:
version: 2
renderer: NetworkManager
ethernets:
enp39s0:
dhcp4: no
addresses: [192.168.3.214/24]
gateway4: 192.168.3.1
nameservers:
addresses: [192.168.3.1,8.8.8.8,8.8.4.4]
import cv2
import glob
from tqdm import tqdm
PATH = "*.jpg"
VID_OUT_PATH = "tmp.mp4"
fourcc = 'mp4v'
fps = 30
width = 1920
height = 1080
img_files = sorted(glob.glob(PATH))
vid_writer = cv2.VideoWriter(
VID_OUT_PATH, 0, cv2.VideoWriter_fourcc(*fourcc), fps, (width, height))
for img_file in tqdm(img_files):
img = cv2.imread(img_file)
# img = cv2.resize(img, (width, height), interpolation=cv2.INTER_AREA)
vid_writer.write(img)
gdown https://drive.google.com/uc?id=<ID_HERE>
sudo rmmod nvidia_uvm
sudo modprobe nvidia_uvm
GIT_SSH_COMMAND='ssh -i /Users/fatih/.ssh/id_rsa_work -o IdentitiesOnly=yes' git clone [email protected]:.....
https://docs.nvidia.com/cuda/wsl-user-guide/index.html
wsl -l -v
wsl --set-default-version 2
- nginx_file.conf
server {
listen 80; # a customed port
# download
autoindex on; # enable directory listing output
autoindex_exact_size off; # output file sizes rounded to kilobytes, megabytes, and gigabytes
autoindex_localtime on; # output local times in the directory
location / {
root /upload;
}
}
- Run docker
FILES_PATH=/home/fatihbaltaci/files
docker run -it --rm --name nginx -p 3042:80 -v $FILES_PATH:/upload -v `pwd`:/usr/share/nginx/html -v /home/fatihbaltaci/nginx_file_server/nginx_file.conf:/etc/nginx/conf.d/default.conf nginx
# Download 11gR2 from https://www.oracle.com/tr/database/technologies/xe-prior-releases.html
# Required:
# - 3G swap
docker run -it --restart always --name oracledb_11g --ipc host -p 8080:8080 -p 1521:1521 -v `pwd`:/workspace -v /home/fatihbaltaci/backup/oracle:/u01 centos:7
yum update -y && yum install -y sudo libaio* bc wget java-1.8.0-openjdk net-tools
cd /workspace/Disk1 && rpm -i oracle-xe-11.2.0-1.0.x86_64.rpm
/etc/init.d/oracle-xe configure
export LD_LIBRARY_PATH=/u01/app/oracle/product/11.2.0/xe/lib:$LD_LIBRARY_PATH
export ORACLE_SID=XE
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
export PATH=$ORACLE_HOME/bin:$PATH
/etc/init.d/oracle-xe status
/etc/init.d/oracle-xe start
. /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh
# 18c
alter session set "_ORACLE_SCRIPT"=true;
create user USER1 IDENTIFIED BY USER1;
GRANT create session TO USER1;
GRANT create table TO USER1;
GRANT create view TO USER1;
GRANT create any trigger TO USER1;
GRANT create any procedure TO USER1;
GRANT create sequence TO USER1;
GRANT create synonym TO USER1;