Skip to content

Instantly share code, notes, and snippets.

@v-thomp4
v-thomp4 / gist:a14134fc7ee098551477758a27e8c7a2
Created February 15, 2020 07:15
set PATH & LD_LIBRARY_PATH env variable for ssh login session
# # set PATH & LD_LIBRARY_PATH env variable for ssh login session
# # Env variable cannot be passed to container - General Discussions - Docker Forums
# # https://forums.docker.com/t/env-variable-cannot-be-passed-to-container/5298/6
# RUN echo 'export PATH=/usr/local/nvidia/bin:$PATH' >> /etc/profile.d/nvidia.sh && \
# echo 'export LD_LIBRARY_PATH=/usr/local/nvidia/lib:/usr/local/nvidia/lib64:$LD_LIBRARY_PATH' >> /etc/profile.d/nvidia.sh
# /etc/pam.d/common-session
...
session optional pam_systemd.so
...
# /etc/ssh/sshd_config
...
UseDNS no
...
@v-thomp4
v-thomp4 / gist:35b937cd616a2cb27ad95a7e5ddbb33a
Last active February 7, 2020 09:47
anaconda for multi-user
cd /tmp
wget https://repo.continuum.io/archive/Anaconda3-2019.03-Linux-x86_64.sh
sh Anaconda3-2019.03-Linux-x86_64.sh
sudo groupadd anaconda
sudo groupmod -g 3000 anaconda
sudo chgrp -R anaconda /opt/anaconda3
sudo chmod 770 -R /opt/anaconda3
sudo adduser username anaconda
source /opt/anaconda3/bin/activate
conda create -n username
@v-thomp4
v-thomp4 / daemon.json
Last active February 6, 2020 11:14
config k3s support gpu
{
"default-runtime": "nvidia",
"runtimes": {
"nvidia": {
"path": "/usr/bin/nvidia-container-runtime",
"runtimeArgs": []
}
}
}
@v-thomp4
v-thomp4 / install-cuda-10-bionic.sh
Last active December 19, 2019 09:10 — forked from bogdan-kulynych/install-cuda-10-bionic.sh
Install CUDA 10 on Ubuntu 18.04
# WARNING: These steps seem to not work anymore!
#!/bin/bash
# Purge existign CUDA first
sudo apt --purge remove "cublas*" "cuda*"
sudo apt --purge remove "nvidia*"
# Install CUDA Toolkit 10
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
@v-thomp4
v-thomp4 / gist:f8d726b9f6ffadcc1c994b3685be5c61
Last active November 28, 2019 10:27
Custom DNS Server not overwriting default servers
sudo apt install -y resolvconf
2/ Edit /etc/resolvconf/resolv.conf.d/head and add the following:
# Make edits to /etc/resolvconf/resolv.conf.d/head.
nameserver 8.8.4.4
nameserver 8.8.8.8
sudo /etc/init.d/resolvconf restart
@v-thomp4
v-thomp4 / gist:3a73143f82b8d76b647dc3af6961c25f
Created November 26, 2019 09:45
Automatically restart SSH sessions and tunnels
autossh -M 0 -o "ServerAliveInterval 10" -o "ServerAliveCountMax 2" -L 9999:localhost:9999 user@server
@v-thomp4
v-thomp4 / gist:26e1cca88245f27e73def873b886e123
Created November 26, 2019 02:23
fix ubuntu 18.04 cannot boot dell inspiron 3000
nano /etc/default/grub
GRUB_CMDLINE_LINUX_DEAULT="acpi=of nouveau.modeset=0"
sudo update-grub
wget http://download.openvz.org/openvz.repo -O /etc/yum.repos.d/openvz.repo
yum install vzkernel vzctl vzquota
vim /etc/sysctl.conf
# On Hardware Node we generally need
# packet forwarding enabled and proxy arp disabled
net.ipv4.ip_forward = 1
net.ipv6.conf.default.forwarding = 1
net.ipv6.conf.all.forwarding = 1
net.ipv4.conf.default.proxy_arp = 0
```
- name: Update WordPress config file
lineinfile:
dest=/var/www/wordpress/wp-config.php
regexp="{{ item.regexp }}"
line="{{ item.line }}"
with_items:
- {'regexp': "define\\( 'DB_NAME', '(.*?)' \\);", 'line': "define('DB_NAME', '{{ wp_mysql_db }}');"}
- {'regexp': "define\\( 'DB_USER', '(.*?)' \\);", 'line': "define('DB_USER', '{{ wp_mysql_user }}');"}
- {'regexp': "define\\( 'DB_PASSWORD', '(.*?)' \\);", 'line': "define('DB_PASSWORD', '{{ wp_mysql_password }}');"}