Skip to content

Instantly share code, notes, and snippets.

Avatar
🏡
Working from Home

Justin Paul recklessop

🏡
Working from Home
View GitHub Profile
View python-slow-type
import sys,time,random
def print_slow(str):
for letter in str:
sys.stdout.write(letter)
sys.stdout.flush()
time.sleep(0.1)
print_slow("Type whatever you want here")
View Netplan-example
network:
version: 2
renderer: networkd
ethernets:
eth0:
match:
macaddress: 3a:8c:83:61:58:70
set-name: eth0
addresses:
- 192.168.0.40/24
View netplan install on rhel74
[root@rhel74 yum.repos.d]# yum install netplan
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Resolving Dependencies
--> Running transaction check
---> Package netplan.x86_64 0:0.40.2-0.el7.1 will be installed
--> Processing Dependency: /usr/bin/python3 for package: netplan-0.40.2-0.el7.1.x86_64
--> Processing Dependency: python34-netifaces for package: netplan-0.40.2-0.el7.1.x86_64
--> Processing Dependency: python34-yaml for package: netplan-0.40.2-0.el7.1.x86_64
--> Processing Dependency: systemd-networkd for package: netplan-0.40.2-0.el7.1.x86_64
View NetplanStaticUserInput.sh
#!/bin/bash
#
# Creates a backup
cp /etc/netplan/01-netcfg.yaml /etc/netplan/01-netcfg.yaml.bk_`date +%Y%m%d%H%M`
# Changes dhcp from 'yes' to 'no'
sed -i "s/dhcp4: yes/dhcp4: no/g" /etc/netplan/01-netcfg.yaml
# Retrieves the NIC information
nic=`ifconfig | awk 'NR==1{print $1}'`
# Ask for input on network configuration
read -p "Enter the static IP of the server in CIDR notation: " staticip
View NetPlanStaticConfig.sh
END_CONFIG=/etc/netplan/01-network-card.yaml
generateAndApply() {
sudo netplan generate
sudo netplan apply
}
getInternetInfo() {
local INTERNET_INFO=$( ip r | grep default )
printf "%s" "$( echo $INTERNET_INFO | cut -f$1 -d' ' )"
View Redhat 7.2 VMware
[root@rhel72 ~]# lsinitrd | grep kernel/driver
drwxr-xr-x 13 root root 0 Nov 2 20:26 usr/lib/modules/3.10.0-327.el7.x86_64/kernel/drivers
drwxr-xr-x 2 root root 0 Nov 2 20:26 usr/lib/modules/3.10.0-327.el7.x86_64/kernel/drivers/ata
-rw-r--r-- 1 root root 13809 Oct 29 2015 usr/lib/modules/3.10.0-327.el7.x86_64/kernel/drivers/ata/ata_generic.ko
-rw-r--r-- 1 root root 52809 Oct 29 2015 usr/lib/modules/3.10.0-327.el7.x86_64/kernel/drivers/ata/ata_piix.ko
-rw-r--r-- 1 root root 365073 Oct 29 2015 usr/lib/modules/3.10.0-327.el7.x86_64/kernel/drivers/ata/libata.ko
-rw-r--r-- 1 root root 11937 Oct 29 2015 usr/lib/modules/3.10.0-327.el7.x86_64/kernel/drivers/ata/pata_acpi.ko
drwxr-xr-x 2 root root 0 Nov 2 20:26 usr/lib/modules/3.10.0-327.el7.x86_64/kernel/drivers/block
-rw-r--r-- 1 root root 131969 Oct 29 2015 usr/lib/modules/3.10.0-327.el7.x86_64/kernel/drivers/block/floppy.ko
-rw-r--r-- 1 root
View VMware CentOS7 kernel modules
Linux cent7.labrack.xyz 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
[root@cent7 ~]# lsinitrd | grep /kernel/drivers
drwxr-xr-x 16 root root 0 Nov 2 18:18 usr/lib/modules/3.10.0-693.el7.x86_64/kernel/drivers
drwxr-xr-x 2 root root 0 Nov 2 18:18 usr/lib/modules/3.10.0-693.el7.x86_64/kernel/drivers/ata
-rw-r--r-- 1 root root 3388 Nov 2 18:18 usr/lib/modules/3.10.0-693.el7.x86_64/kernel/drivers/ata/ata_generic.ko.xz
-rw-r--r-- 1 root root 8948 Nov 2 18:18 usr/lib/modules/3.10.0-693.el7.x86_64/kernel/drivers/ata/ata_piix.ko.xz
-rw-r--r-- 1 root root 94212 Nov 2 18:18 usr/lib/modules/3.10.0-693.el7.x86_64/kernel/drivers/ata/libata.ko.xz
-rw-r--r-- 1 root root 3304 Nov 2 18:18 usr/lib/modules/3.10.0-693.el7.x86_64/kernel/drivers/ata/pata_acpi.ko.xz
drwxr-xr-x 2 root root 0 Nov 2 18:18 usr/lib/modules/3.10.0-693.el7.x86_64/kernel/drivers/block
-rw-r--r-- 1 root