(to prevent "Daily GeoIP Database Download Limit Reached" error :-) )
Category: tech
Bat script for rename gopro files
@echo off
echo.
echo Changing file number position in GoPro filenames
echo like this: GXXXYYYY*.* ^<-^> YYYYGXXX*.*
setlocal enabledelayedexpansion
echo.
for /f "delims= eol=:" %%f in ('dir /b /a-d G???????*.* ????G???*.*') do (
set filename=%%~nf
set firstfour=!filename:~0,4!
set secondfour=!filename:~4,4!
echo %%f ^> !secondfour!!firstfour!!filename:~8!%%~xf
ren %%f !secondfour!!firstfour!!filename:~8!%%~xf
)
echo.
echo Done.
pause
[fix] mongodump fails after upgrade mongodb to 5.0 (error counting admin.system.new_users)
This recipe will help if you got error like this:
Failed: error creating intents to dump: error creating intents for database admin: error counting admin.system.new_users: (Unauthorized) not authorized on admin to execute command { count: "system.new_users"
The one working workaround at this time is (if we using in mongodump user "admin"):
db.createRole({
role: 'mongodump_fix_role',
privileges: [ { resource : { "db" : "admin", "collection" : "system.new_users" }, actions: [ "find" ] }],
roles: []
})
db.grantRolesToUser("admin", [{ role: "mongodump_fix_role", db: "admin" }])
More info: https://www.mongodb.com/community/forums/t/dropping-admin-system-new-users-collection/219435
Convert the public key format from SSH2 to OpenSSH
ssh-keygen -i -f ssh2.pub
Using chroot
--rbind
, some subdirectories of dev/
and sys/
will not be unmountable. Attempting to unmount with umount -l
in this situation will break your session, requiring a reboot. If possible, use -o bind
instead.In the following example, /location/of/new/root
is the directory where the new root resides.
First, mount the temporary API filesystems:
# cd /location/of/new/root # mount -t proc /proc proc/ # mount -t sysfs /sys sys/ # mount --rbind /dev dev/
And optionally:
# mount --rbind /run run/
If you are running a UEFI system, you will also need access to EFI variables. Otherwise, when installing GRUB, you will receive a message similar to: UEFI variables not supported on this machine
:
# mount --rbind /sys/firmware/efi/efivars sys/firmware/efi/efivars/
Next, in order to use an internet connection in the chroot environment, copy over the DNS details:
# cp /etc/resolv.conf etc/resolv.conf
Finally, to change root into /location/of/new/root
using a bash shell:
# chroot /location/of/new/root /bin/bash
chroot: cannot run command '/usr/bin/bash': Exec format error
, it is likely that the architectures of the host environment and chroot environment do not match.chroot: '/usr/bin/bash': permission denied
, remount with the execute permission:mount -o remount,exec /location/of/new/root
.
After chrooting, it may be necessary to load the local bash configuration:
# source /etc/profile # source ~/.bashrc
# export PS1="(chroot) $PS1"
When finished with the chroot, you can exit it via:
# exit
Then unmount the temporary file systems:
# cd / # umount --recursive /location/of/new/root
umount: /path: device is busy
, this usually means that either: a program (even a shell) was left running in the chroot or that a sub-mount still exists. Quit the program and use findmnt -R /location/of/new/root
to find and then umount
sub-mounts. It may be tricky to umount
some things and one can hopefully have umount --force
work. As a last resort, use umount --lazy
which just releases them. In either case to be safe, reboot
as soon as possible if these are unresolved to avoid possible future conflicts.VIM registers
Registers in Vim let you run actions or commands on text stored within them. To access a register, you type "a before a command, where a is the name of a register.
If you want to copy the current line into register k, you can type
"kyy
Or you can append to a register by using a capital letter
"Kyy
You can then move through the document and paste it elsewhere using
"kp
To paste from system clipboard on Linux
"+p
To paste from system clipboard on Windows (or from "mouse highlight" clipboard on Linux)
"*p
To access all currently defined registers type
:reg
Conver heic to jpg in linux
https://github.com/monostream/tifig/releases
find . -type f -iname '*.heic' -exec tifig -v -q 100 -i '{}' -o '{}.jpg' \; find . -type f -iname '*.heic' -delete find . -type f -iname '*.heic'
Old Jira color codes
Upgrade from 7.2.4 to 7.13 break my eyes.
This colors uses in old Jira:
Header Background Color #205081
Header Highlight Background Color #296CA3
Header Separator Color #2E3D54
Header Text Color #ffffff
Header Text Highlight Color #f0f0f0
Menu Item Highlight Background Color #3b73af
Menu Item Highlight Text Color #ffffff
Button Background Color #3b7fc4
Button Text Color, #ffffff
Link Active Color #3b73af
Heading Color #292929
Link Color #3b73af
Gadget Colors
Color 1 (Default) #3b73af
Color 2 #d04437
Color 3 #ea632b
Color 4 #14892c
Color 5 #205081
Color 6 #654982
Color 7 #707070
find regex egrep
find . -type f -regex '.*\.php\|.*\.htm*' -exec egrep -l "yandex|metrica" {} \;
sync: Сколько осталось данных в кеше
watch grep -e Dirty: -e Writeback: /proc/meminfo