Skip to content

Instantly share code, notes, and snippets.

@o3bvv
o3bvv / run.sh
Last active May 8, 2021 06:22
Delete old kernels from Ubuntu
#!/bin/sh
# 1. List old versions by:
# 1.1. Listing all "initrd.img-*" files in "/boot" (ls -1), ex: "/boot/initrd.img-5.8.0-44-generic"
# 1.2. Excluding current LOADED version (grep -v), ex: "5.8.0-50-generic"
# 1.3. Extracting version part from listed filenames (awk), ex: "5.8.0-44"
# 2. Purge kernel packages per each version, with confirmation prompt (configmation is enabled by default)
for v in $(ls -1 /boot/initrd.img-* | grep -v `uname -r` | awk -F'-' '{ print $2 "-" $3 }'); do \
sudo apt-get --purge remove \
linux-image-$v-generic \
@o3bvv
o3bvv / install-python.sh
Last active March 2, 2021 11:01
Installing Python from sources
#!/usr/bin/bash
CC=x86_64-linux-gnu-gcc
CFLAGS=-g -fstack-protector-strong -Wformat -Werror=format-security
LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro -g -fwrapv -O2
CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2
configure --enable-optimizations --with-ensurepip=install --enable-shared --prefix=/usr/local/ --enable-loadable-sqlite-extensions --with-dbmliborder=bdb:gdbm --with-computed-gotos --with-system-expat --with-system-ffi
make # -j 4
make altinstall
@o3bvv
o3bvv / example.sh
Created December 9, 2020 09:15
N most recently created files in a directory
find . -type f -printf "%T@ %TFT%TT %p\n" | sort -nr | head
@o3bvv
o3bvv / create-task_delete-old-service-logs.ps1
Last active August 24, 2020 17:01
Deleting old log files on Windows periodically (see https://serverfault.com/a/1031301/252212)
[CmdletBinding()]
param(
[Parameter(Position=0, Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$LogsDirPath,
[Parameter(Position=1)]
[int]$LogsFileMaxN = 31,
@o3bvv
o3bvv / gist:6854531d3467e3fecc23a40fa4722c4d
Created August 23, 2020 15:18
Windows Explorer — Start At "My PC"
%SystemRoot%\explorer.exe /E,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}
@o3bvv
o3bvv / run.sh
Last active March 24, 2020 14:14
Resize Big Pictures in Bulk
#!/usr/bin/env bash
CURRENT_DIR=$(pwd)
MAX_SIDE_SIZE=1024 # see also: https://www.imagemagick.org/script/command-line-processing.php#geometry
JPEG_EXTENSION_PRIMARY=jpg
JPEG_CONVERSION_QUALITY=85
@o3bvv
o3bvv / .vimrc
Last active July 20, 2022 14:13
vim config
syntax enable
set background=dark
colorscheme solarized
set tabstop=2
set softtabstop=2
set expandtab
set number
set showcmd
set cursorline
@o3bvv
o3bvv / cloudSettings
Last active October 9, 2020 18:34
vs-settings
{"lastUpload":"2020-10-09T18:34:13.168Z","extensionVersion":"v3.4.3"}
@o3bvv
o3bvv / keybase.md
Created March 12, 2019 13:24
Keybase proof

Keybase proof

I hereby claim:

  • I am oblalex on github.
  • I am oblalex (https://keybase.io/oblalex) on keybase.
  • I have a public key ASAYaQtPc4HObTkRNUyutE0_zjIESyfe8FC231SGgBZbWwo

To claim this, I am signing this object:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>IL-2 FB Locations</name>
<description></description>
<Style id="primary">
<LineStyle><color>ff0088ff</color><width>5</width></LineStyle>
<PolyStyle><color>660088ff</color></PolyStyle>
</Style>