Skip to content

Instantly share code, notes, and snippets.

View dmitriysafronov's full-sized avatar
👁️
У человека, достигшего просветления в России, третий глаз - дёргается

Dmitriy Safronov dmitriysafronov

👁️
У человека, достигшего просветления в России, третий глаз - дёргается
View GitHub Profile
@dmitriysafronov
dmitriysafronov / fedora-nvidia
Last active August 2, 2020 13:13
Fedora NVidia proprietary driver setup
#!/bin/sh
## Remember to update kernel* and selinux-policy* before proprietary driver installation!!!
echo "Updating kernel & selinux policy..."
yum update kernel* selinux-policy*
echo "Erasing nouveau Xorg driver..."
yum erase xorg-x11-drv-nouveau
echo "Installing NVidia drivers"
yum install kmod-nvidia
@dmitriysafronov
dmitriysafronov / ubuntu-ct-preconfig
Last active October 24, 2016 09:46
Preconfigure a Ubuntu OpenVZ minimal container
#!/bin/sh
apt-get update
apt-get install -y apt-utils dialog htop most mc
apt-get dist-upgrade -y
reboot
###
#!/bin/bash
if [[ -n "$(which apt)" ]]; then
apt install -y wget unzip automake autoconf gcc make asterisk-dev
DESTDIR=/usr/lib/asterisk/modules
LDFLAGS="-z muldefs"
elif [[ -n "$(which yum)" ]]; then
yum install -y wget unzip automake autoconf gcc make asterisk-devel
DESTDIR=/usr/lib64/asterisk/modules
LDFLAGS=""
#!/bin/bash
yum install -y wget tcl
########
OLD_PWD="${PWD}"
########
#!/bin/bash
if [[ -z "$(hostname -d)" ]]; then
echo "Set up FQDN first!"
exit 0
fi
echo "postfix postfix/mailname string $(hostname -f)" | debconf-set-selections
echo "postfix postfix/destinations string \$myhostname, $(hostname -s), localhost" | debconf-set-selections
#!/bin/bash
if [[ -z "$1" ]]; then
echo "Unified cert?"
exit 1
fi
if [[ -z "$2" ]]; then
echo "Which cert?"
exit 1
@dmitriysafronov
dmitriysafronov / force-modeswitch
Created December 9, 2016 10:06
F*cking usb-modeswitch doesnt work properly
#!/bin/bash
USB_VENDOR=12d1
USB_PRODUCT=14fe
USB_OPTIONS=-J
while [[ -n "$(lsusb | grep ${USB_VENDOR} | grep ${USB_PRODUCT})" ]]; do
usb_modeswitch -v ${USB_VENDOR} -p ${USB_PRODUCT} -R ${USB_OPTIONS}
sleep 10
done
## Modem symlinks
# Modem: 0
KERNEL=="ttyUSB*", KERNELS=="1-2:1.2", SYMLINK+="Modem0-audio"
KERNEL=="ttyUSB*", KERNELS=="1-2:1.3", SYMLINK+="Modem0-data"
# Modem: 1
KERNEL=="ttyUSB*", KERNELS=="1-1:1.2", SYMLINK+="Modem1-audio"
KERNEL=="ttyUSB*", KERNELS=="1-1:1.3", SYMLINK+="Modem1-data"
@dmitriysafronov
dmitriysafronov / reconfigure-domain-access
Last active July 1, 2017 20:17
Костыли для PAM и sudo
#!/bin/bash
CONF_PRESETS=/etc/domain-access.conf
########################################################################################################################################
if [[ -s ${CONF_PRESETS} ]]; then
source ${CONF_PRESETS}
else
echo -e "#GROUP_LOGIN=\"A rAnDoM dOmAiN gRoUp\"\n#GROUP_SSHD=\"OtHeR rAnDoM dOmAiN gRoUp\"\n#GROUP_SUDO=\"AnOtHeR rAnDoM dOmAiN gRoUp\"" > ${CONF_PRESETS}
@dmitriysafronov
dmitriysafronov / reconfigure-hostname
Last active February 16, 2017 09:49
Костыль для изменения FQDN/hostname
#!/bin/bash
if [[ -z "$(which wbinfo)" || -z "$(wbinfo -t > /dev/null 2>&1 && echo ok)" ]]; then
if [[ -z "$1" ]]; then
echo "FQDN/hostname required!"
exit 1
fi
TMP_FQDN=$1