Skip to content

Instantly share code, notes, and snippets.

@fl64
fl64 / lsof.sh
Last active December 18, 2017 18:41
OTUS Linux HW6 lsof.sh v2 (works on CentOS 7.4)
#!/bin/bash
getstate()
{
case $1 in
'01') st='ESTABLISHED';;
'02') st='SYN_SENT';;
'03') st='SYN_RECV';;
'04') st='FIN_WAIT1';;
'05') st='FIN_WAIT2';;
'06') st='TIME_WAIT';;
@fl64
fl64 / Vagrantfile
Last active December 18, 2017 18:42
OTUS Linux HW1 - vagrant file
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box_check_update = false
config.vm.box_url = [ 'https://otus.ru/media/c7.4.box' ]
config.vm.box = "c7.4"
config.vm.hostname = "disks"
# Basic configuration withour variables
# Define authentification configuration
provider "vsphere" {
# If you use a domain set your login like this "MyDomain\\MyUser"
user = "example.com\\username"
password = "P@ssw0rd"
vsphere_server = "10.0.0.10"
# if you have a self-signed cert
matrix = [[0 for x in range(8)] for x in range(8)]
move = ((1,0), (0,1), (-1,0), (0,-1))
f=0
x=0
y=0
z=1
#!/bin/bash
printf "%5s %-8s %-5s %2s:%02d %s \n" "PID" "TTY" "STAT" "TIME" "COMMAND"
for i in /proc/[0-9]*; do
#read pid cmd state ppid pgrp sid tty_nr tpgid other < $i/stat
# 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
# $pid $cmd $state $ppid $pgrp $sid $tty_nr $tpgid flags minflt cminfflt majflt cmajflt utime stime cutime cstime priority nice
regex='([0-9]*) \((.*)\).* ([DRSTWXZ]+) ([0-9]*) ([0-9]*) ([0-9]*) ([0-9]*) (\-?[0-9]*) ([0-9]*) ([0-9]*) ([0-9]*) ([0-9]*) ([0-9]*) ([0-9]*) ([0-9]*) ([0-9]*) ([0-9]*) ([0-9]*) (\-?[0-9]*) ([0-9]*) ([0-9]*) ([0-9]*)'
read out < $i/stat
@fl64
fl64 / preseed.cfg
Last active November 16, 2018 21:47
Ubuntu xenial preseed file with LVM for factory.loc server
### user settings
d-i passwd/username string bot-install
d-i passwd/user-fullname string bot-install
d-i passwd/user-password password 12qw!@QW
d-i passwd/user-password-again password 12qw!@QW
d-i user-setup/allow-password-weak boolean true
### regional setting
d-i debian-installer/language string en_US:en
d-i debian-installer/country string US
@fl64
fl64 / preseed-nolvm.cfg
Created November 16, 2018 21:57
Linux xenial preseed
### user settings
d-i passwd/username string bot-install
d-i passwd/user-fullname string bot-install
d-i passwd/user-password password 12qw!@QW
d-i passwd/user-password-again password 12qw!@QW
d-i user-setup/allow-password-weak boolean true
### regional setting
d-i debian-installer/language string en_US:en
d-i debian-installer/country string US
@fl64
fl64 / preseed-lvm-2vols.cfg
Created November 19, 2018 19:08
ubuntu xenial
### user settings
d-i passwd/username string bot-install
d-i passwd/user-fullname string bot-install
d-i passwd/user-password password 12345678
d-i passwd/user-password-again password 12345678
d-i user-setup/allow-password-weak boolean true
### regional setting
d-i debian-installer/language string en_US:en
d-i debian-installer/country string US
@fl64
fl64 / root-extend.service
Created November 21, 2018 12:28
Root partition extender
[Unit]
Description=Root partition extender
[Service]
Type=oneshot
ExecStart=/bin/bash /usr/local/sbin/root-extend.sh
[Install]
WantedBy=multi-user.target
@fl64
fl64 / chromium-browser.profile
Created January 18, 2019 17:10
Chromium firejail profile ~/.config/firejail/chromium-browser.profile
# Firejail profile for chromium
# This file is overwritten after every install/update
# Persistent local customizations
include /etc/firejail/chromium.local
# Persistent global definitions
include /etc/firejail/globals.local
noblacklist ${HOME}/.cache/chromium
noblacklist ${HOME}/.config/chromium
noblacklist ${HOME}/.config/chromium-flags.conf