Creating PDF File From Multiple Images Of Different Sizes

export SIZE='4960x7014' && \ convert image_* \ -resize "${SIZE}"'^>' \ -extent "${SIZE}" \ -gravity center \ -background white \ -units PixelsPerInch \ -density 600 result.pdf export SIZE='4960x7014': export: This bash shell command sets the environment variable SIZE to be available to subsequent commands. SIZE=‘4960x7014’: This sets the value of the SIZE environment variable to the string 4960x7014, which represents the dimensions (width x height) for an image in pixels. convert image_*:...

February 18, 2024

Convert OnePlus 12 From ColorOS to OxygenOS

How to convert OnePlus 12 from ColorOS to OxygenOS using Linux Intro Somehow I decided to order a new phone from China. At the same time, I missed the moment to explore how problematic this option is. As a result, I received a phone with the ColorOS operating system, which is designed for the Chinese region. The seller wrote to me after receiving the phone that it could be blocked in case of an attempt to update it....

February 4, 2024

Runlevels in Systemd

Once, when loading into Asahi, the keyboard stopped working after loading the X server. It was necessary to boot into a bare terminal without starting the X server, but how to do it? One of the rough options is to boot into bash as an init process. The second option is to redefine the runlevel to the one in which X does not run. To do this, when loading grub, go to the edit start line menu by pressing the “e” key....

April 7, 2023

Moving from MacOS to Asahi Linux

Moving from MacOS to Asahi Linux Status Hardware 3.5mm Audio Jack: ⚠ (It’s been detected properly, but not working) 1 Bluetooth: ✅ Camera: ❌ Fingerprint: ❌ HDMI: ❌ Speakers: ❌ Touchpad: ✅ Wi-Fi: ✅ Software Obsidian: ✅ RVM: ⚠ (rvm is installed but ruby build fails) Slack: ❌ Telegram: ✅ Zoom: ❌ Functionality Brightness Control: ✅ Hibernate: ❌ Suspend to RAM: ⚠ (OS is being suspended but laptop is keep working and draining battery) References Asahi Feature Support

April 3, 2023

VIM: Handle Urls

Making a shortcut to open urls under cursor Note: There is also available gx shortcut that uses netrw plugin. But I’ve decided to use own little solution instead of big plugin for one function. """ open urls using \u shortcut function HandleURL() let l:uri = matchstr(getline("."), '[a-z]*:\/\/[^ >,;)]*') if l:uri != "" silent call system("xdg-open " . shellescape(l:uri, 1)) else echo "No URI found in line." endif endfunction nnoremap <leader>u :call HandleURL()<cr> """ Now if we hit \u shortcut while our cursor is on the url line, this url will be opened in default browser....

October 15, 2020

VIM: Making Markdown Checklist Shortcut

Interesting exercise to implement shortcut in vim. Often while writing markdown files in vim I’m writing a lot of checkboxes. It’s a bit annoying to do by hand so let’s make a script and bind it to shortcut. """ markdown shortcuts function MarkdownCheckboxInsert() let l:line = line('.') let l:str = getline(l:line) let l:match = matchlist(l:str, '^\([ ]*\)\?\([-+*]\)\? \?\(.*\)$') if empty(l:match[2]) let l:list_syn = '-' else let l:list_syn = l:match[2] endif let l:buf = l:match[1] ....

October 14, 2020

VIM: YCM and Pipenv

While writing another python script under pipenv I have met a problem that YCM autocomplete worked only for built in functions. That was annoying because without autocomplete YCM looses it’s sense. Solution Let’s create module for filetype plugin. cat ~/.vim/after/ftplugin/python.vim if !empty($VIRTUAL_ENV) let g:ycm_server_python_interpreter = $VIRTUAL_ENV . '/bin/python' let $PYTHONPATH = finddir('site-packages', $VIRTUAL_ENV . '/lib/*') endif Then you can simply run command pipenv run vim some/script.py And now YCM works correctly :3

October 14, 2020

ZSH: auto git config.user

On my laptop and desktop I usually have many git repositories. Some of them are personal and some of them are from my main job. In companies it’s common practice to have corporate email that used in repository configuration. git config user.name "Mr Anderson" git config user.email "anderson@corp.in" In personal repository you may use some cool nickname and personal email. git config user.name "Neo" git config user.email "0xff@matr.ix" But there is an headache to not forget configure every repository to be corporate or personal after cloning....

June 25, 2020

Network: Capturing TCP Retransmissions

When server have a lot network connections it’s not rare to see tcp retransmissions. The permanent background retransmissions it’s even normal situation if it’s not abnormally high. But when the charts shows abnormally jump of retransmissions it’s good to find the reason. The reason is may be: server is overloaded remote server is overloaded network where servers is based is degraded network of remote endpoint is degraded When servers is not overloaded the next step is to find which endpoint causes the retransmissions....

June 20, 2020

VIM: Append Filetype

If you open a file with a non-standard extension, syntax highlighting will not work. This is easily solved by installing filetype manually. :set filetype=markdown You can add a hint for VIM about the file type to the file so that you don’t have to set the type manually the next time. ~ cat Readme # vi:syntax=markdown I wanted to make a hotkey to add information about its type to the end of the file....

June 6, 2020