kido-ih
kido-ih
just another random IT geek notes blog
23 posts
Don't wanna be here? Send us removal request.
kido-ih · 2 months ago
Text
Force time sync (systemd v213+)
systemctl restart systemd-timesyncd.service
0 notes
kido-ih · 10 months ago
Text
Helm
### List repositories helm repo list
### Add helm repository 'foo' helm repo add foo https://charts.example.org
### Deploy 'foo' chart from repo/projectname in to currently selected cluster (kubectl config get-contexts) helm upgrade --install foo repo/projectname
0 notes
kido-ih · 3 years ago
Text
Get telegram chat ID
Ensure your bot has been invited to chat and has enough permissions to read chat history
curl https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates
You may need to send a message to the chat to get any new update with chat ID
0 notes
kido-ih · 4 years ago
Text
NextCloud LOCKED error fix
docker exec -it nextcloud_app su - www-data -s /bin/sh -c "/var/www/html/occ maintenance:mode --on" docker exec -it nextcloud_db psql -U oc_nextcloud --dbname nextcloud SELECT * FROM oc_file_locks; DELETE FROM oc_file_locks WHERE lock=1; docker exec -it nextcloud_app su - www-data -s /bin/sh -c "/var/www/html/occ maintenance:mode --off"
0 notes
kido-ih · 4 years ago
Text
Connect to SMTP server and send e-mail with openssl/netcat/telnet
Option A)
echo -ne "\[email protected]\0password" | base64 openssl s_client -starttls smtp -connect smtp.example.org:587 EHLO smtp.example.org AUTH PLAIN <echo to base64 output here>
Option B)
echo -ne "username" | base64 echo -ne "password" | base64 openssl s_client -starttls smtp -connect smtp.example.org:587 EHLO smtp.example.org AUTH LOGIN <base64 encoded username> <base64 encoded password>
Sending e-mail:
Once logged in, continue with following:
MAIL FROM: [email protected] rcpt to: [email protected] DATA From: [email protected] To: [email protected] Subject: Testing e-mail
Hello, This e-mail is only a test. . QUIT
0 notes
kido-ih · 4 years ago
Text
Bootable USB on macOS
curl http://example.org/image.iso -o image.iso
diskutil eraseDisk MS-DOS FAT32 disk2
diskutil umount /dev/disk2s2
hdiutil convert -format UDRW -o image image.iso
sudo dd if=image.dmg of=/dev/disk2 bs=4m; sync
diskutil eject disk2
0 notes
kido-ih · 4 years ago
Text
terraformer examples (to be completed)
Import all resources from AWS in region eu-north-1
terraformer import aws --regions=eu-north-1 --resources="*"
0 notes
kido-ih · 4 years ago
Text
Clone repo with specific key
This is how you can clone some repository using a specific private OpenSSH key:
# GIT_SSH_COMMAND="ssh -o PreferredAuthentications=publickey -o UserKnownHostsFile=/dev/null -o PubkeyAuthentication=yes -o User=git -o StrictHostKeyChecking=no -o CheckHostIP=no -o Hostname=gitlab.com -i /root/.ssh/id_rsa.pem" git clone [email protected]:example/repository.git /var/www/example.org
0 notes
kido-ih · 4 years ago
Text
postgres cheatsheet
# start interactive postgres cli psql -U postgres
# connect to database foo \c foo;
# list all databases \l
# list all users \du
# list all tables \dt
# create role 'foo' CREATE ROLE foo;
# create database 'foo' with owner bar CREATE DATABASE foo WITH OWNER bar;
# select id,username,password fields from users table SELECT id,username,password from users
# update field password of id 123 in users table UPDATE users SET password = 'somevalue' WHERE id = '123'; # remove all tables in current database DO $$ DECLARE   r RECORD; BEGIN   FOR r IN (SELECT tablename FROM pg_tables WHERE schemaname = current_schema()) LOOP     EXECUTE 'DROP TABLE ' || quote_ident(r.tablename) || ' CASCADE';   END LOOP; END $$;
3 notes · View notes
kido-ih · 4 years ago
Text
Limiting playbook run to multiple hosts
Wonder how you can limit running playbooks to a multiple hosts at once? Manpage doesn't describe that, but I found a hack for this:
ansible-playbook -l 'host1:host2' main.yml
0 notes
kido-ih · 4 years ago
Text
Ansible optimized config
Use this ansible.cfg to make your ansible work way more efficient than it comes out-of-box:
[defaults]
gathering = smart
inventory = ./hosts.yml
host_key_checking = False
deprecation_warnings = False
[ssh_connection]
ssh_args = -C -o ControlMaster=auto -o ControlPersist=10m -o IdentitiesOnly=yes
pipelining = True
transfer_method = piped
0 notes
kido-ih · 4 years ago
Text
ImageMagick cheatsheet
Create Grayscale multipage TIFF from JPEGs and reduce it's size
convert foo.jpg +append bar.jpg -resize 90% -colors 2 -colorspace Gray -type Palette baz.tif
1 note · View note
kido-ih · 4 years ago
Text
ffmpeg for iOS
Fucking finally found the working set of parameters for ffmpeg in order to convert media to format compatible with playing on iOS devices! Yay!
ffmpeg -an -i input.mp4 -vcodec libx264 -crf 25 -preset slow -codec:a aac -qscale:a 1 -pix_fmt yuv420p -profile:v baseline -level 3 output.mp4
Possible values for preset (faster option gives larget output filesize): -preset: ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow, placebo
Possible values for crf (lower number - larger output filesize): -crf: 0-51
1 note · View note
kido-ih · 5 years ago
Text
# Docker cheat sheet
 - List images # docker images
 - List running containers # docker container ps
 - List all containers # docker container ps -a
 - List volumes # docker volume ls
 - Stop container `foo` # docker container stop foo
 - Kill container `foo` # docker container kill foo
- Execute command `bar` in running container `foo` # docker exec -it foo bar
- Start stopped container `foo` # docker container start `foo`
- Run container from image `bar` in the background # docker run -d bar
 - Run container from image `bar` in the background, overriding defined ENTRYPOINT # docker run -d bar --entrypoint /bin/bash
 - Configure running container `foo` to restart automatically unless stopped # docker update --restart unless-stopped foo
- Remove all unused stuff # docker system prune
0 notes
kido-ih · 5 years ago
Text
Adjust natural scrolling in MATE window manager
Edit /usr/share/X11/xorg.conf.d/40-libinput.conf
Find section with the device you want to adjust and add following line in this section:
Option “NaturalScrolling” “on”
Save file and restart X server or reboot your machine
0 notes
kido-ih · 5 years ago
Text
Send emails from linux host
# apt install msmtp
/etc/msmtprc:
defaults port 587 tls on tls_trust_file /etc/ssl/certs/ca-certificates.crt
account <account-name> host smtp.example.org from <your-email> auth on user <your-username> password <your-password>
account default : <account-name>
echo -e "Subject: test email" | msmtp [email protected]
0 notes
kido-ih · 5 years ago
Text
Adjust pinentry program for gpg-agent
# Add following line to the ~/.gpg-agent.conf:
pinentry-program /path/to/pinentry-program
# And restart the GPG agent in order to make new settings take effect:
gpgconf --reload
0 notes