General Linux

Easy SSH tunneling.

MySQL example:

$ autossh -M 0 -o "ServerAliveInterval 30" -o "ServerAliveCountMax 3" -L 5000:localhost:3306 [email protected]

RHEL/CentOS

Configure a Postfix Relay through Gmail on CentOS 7

When installing on VMware, add the following line to fix the screen resolution: vga=794

Bare metal and Virtual Machine Provisioning through Foreman Server


Create LVM Volume

# pvcreate /dev/sdb1
# vgcreate opt_vg /dev/sdb1
# lvcreate -n opt_lv -l 100%FREE opt_vg

Using Packer to create a VM in vSphere

{
 "builders": [
   {
     "type": "vsphere-iso",
     "boot_command": [
       "<tab> text ks=hd:fd0:/KS.CFG<enter><wait>"
     ],
     "boot_wait": "10s",
     "vcenter_server": "",
     "username": "[email protected]",
     "password": "",
     "insecure_connection": "true",
     "vm_name": "test-centos7",
     "cluster": "Production",
     "datastore": "vm-storage",
     "guest_os_type": "rhel7_64Guest",
     "ssh_username": "root",
     "ssh_password": "",
     "CPUs": 2,
     "RAM": 2048,
     "RAM_reserve_all": true,
     "disk_controller_type": "pvscsi",
     "disk_size": 32768,
     "disk_thin_provisioned": true,
     "network_card": "vmxnet3",
     "network": "Management",
     "iso_paths": [
       "[ISOs] Linux/CentOS/CentOS-7-x86_64-NetInstall-1804/CentOS-7-x86_64-NetInstall-1804.iso"
     ],
     "floppy_files": [
       "ks.cfg"
     ]
   }
 ],
 "provisioners": [
   {
     "type": "file",
     "source": "CentOS-Base.repo",
     "destination": "/tmp/CentOS-Base.repo"
   },
   {
     "type": "shell",
     "inline": ["rm /etc/yum.repos.d/CentOS-Base.repo && cp /tmp/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo && yum update -y && yum install -y vim bash-completion"]
   }
 ]
}

Install VirtualBox guest additions on CentOS Stream 9:

# dnf -y install gcc make bzip2 tar kernel-devel elfutils-libelf-devel
# mount /dev/cdrom /mnt
# cd /mnt
# ./VBoxLinuxAdditions.sh

Radicale

Installing Radicale using Gunicorn and Nginx on CentOS 7

Install nginx: Nginx is in the EPEL so install that first.

# yum install -y epel-release
# yum install -y nginx

We are going to run Radicale and Gunicorn in a virtual environment, so we need to install virtualenv

# yum install -y python-virtualenv

Create a radicale user to run the application:

# adduser radicale

Make them a member of the nginx group so that Nginx can access the files:

# usermod -aG nginx radicale

Create the application folder and set the permissions:

# mkdir /opt/radicale
# chown -R radicale:nginx /opt/radicale

Switch to the radicale user:

# su - radicale

Create the app directory and virtualenv:

$ cd /opt/radicale
$ virtualenv venv
$ source venv/bin/activate
$ pip install radicale gunicorn

/opt/radicale/wsgi.py

import radicale

radicale.log.start()
application = radicale.Application()

/etc/systemd/system/radicale.service

[Unit]
Description=Radicale
After=network.target

Service]
User=radicale
Group=nginx
WorkingDirectory=/opt/radicale
ExecStart=/opt/radicale/venv/bin/gunicorn --workers=3 --bind=unix:/opt/radicale/radicale.sock wsgi:application

[Install]
WantedBy=multi-user.target

Optional bcrypt support.

# yum install -y gcc libffi-devel
# su - radicale
$ cd /opt/radicale
$ source venv/bin/activate
(venv)$ pip install bcrypt passlib

References

How To Set Up Django with Postgres, Nginx, and Gunicorn on CentOS 7: https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-centos-7

How to use selinux on your Redhat/CentOS server. http://blog.centralserv.co.uk/how-to-use-selinux-on-centos-6-5/

Debian/Ubuntu

Script to update everything:

/usr/local/sbin/update-all

#!/bin/bash

if [[ $EUID -ne 0 ]]; then
  echo "This script must be run as root." 1>&2
  exit 1
fi

/usr/bin/apt-get update && \
/usr/bin/apt-get dist-upgrade -y && \
/usr/bin/apt-get autoremove -y

if [ -f /var/run/reboot-required ]; then
  echo "One or more updates require a reboot of the machine." 1>&2
fi

To run it in cron as root

SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h  dom mon dow   command
0 3 * * * /usr/local/sbin/update-all > /var/log/update-all.log 2>&1

Windows

Create a shortcut to Windows Update on the desktop for all users.

In C:\Users\Public\Desktop, create a shortcut with the following path:

%SystemRoot%\explorer.exe shell:::{36eef7db-88ad-4e81-ad49-0e313f0c35f8}

To make the icon match, use the one located in the following DLL:

%SystemRoot%\System32\wucltux.dll

You can use this PowerShell script to automatically create it:

$WshShell = New-Object -comObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut("$env:PUBLIC\Desktop\Windows Update.lnk")
$Shortcut.TargetPath = "$env:SystemRoot\explorer.exe"
$Shortcut.Arguments = "shell:::{36eef7db-88ad-4e81-ad49-0e313f0c35f8}"
$Shortcut.WorkingDirectory = "$env:SystemRoot"
$Shortcut.IconLocation = "$env:SystemRoot\System32\wucltux.dll"
$Shortcut.Save()

Python

SQL Alchemy Cheat Sheet: https://github.com/crazyguitar/pysheeet/blob/master/docs/notes/python-sqlalchemy.rst

Puppet

When creating a new module with PDK, running unit tests gives the following message:

Deprecation Warnings:

puppetlabs_spec_helper: defaults `mock_with` to `:mocha`. See https://github.com/puppetlabs/puppetlabs_spec_helper#mock_with to choose a sensible value for you

To switch to :mocha as mentioned, create .sync.yml in the module directory and add the following lines:

---
spec/spec_helper.rb:
  mock_with: ':rspec'

The run pdk update to apply the changes.


Apache example with settings I commonly use:

class { 'apache': }

apache::vhost  { 'myserver.domain.local':
    port                => '443',
    ssl                 => true,
    ssl_cert            => '/etc/pki/tls/certs/mydomain.pem',
    ssl_chain           => '/etc/pki/tls/certs/mychain.pem',
    ssl_key             => '/etc/pki/tls/private/mydomain_key.pem',
    docroot             => '/var/www/html',
    override            => ['All'],
    options             => ['-Indexes'],
    setenv              => ['MY_ENV_VARIABLE production'],
    proxy_preserve_host => true,
    proxy_pass          => [
      { 'path' => '/backend/', 'url' => 'http://localhost:9000/backend/' },
      { 'path' => '/static/', 'url' => 'http://localhost:9001/static/' },
    ],
}

With multiple directories:

class { 'apache': }

apache::vhost { 'myserver.domain.local':
  port        => '443',
  ssl         => true,
  ssl_cert    => '/etc/pki/tls/certs/mydomain.pem',
  ssl_chain   => '/etc/pki/tls/certs/mychain.pem',
  ssl_key     => '/etc/pki/tls/private/mydomain_key.pem',
  docroot     => '/var/www/html',
  setenv      => ['MY_ENV_VARIABLE production'],
  directories => [
    {
      'path'           => '/var/www/html',
      'provider'       => 'directory',
      'allow_override' => ['All'],
      'options'        => ['-Indexes'],
    },
  ],

Java

Create a WAR file:

$ jar -cvf helloworld.war *

Perl

Exchange

Testing autodiscover

autod.xml

<?xml version="1.0" encoding="UTF-8"?>
<Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/outlook/requestschema/2006">
    <Request>
        <EMailAddress>[email protected]</EMailAddress>
        <AcceptableResponseSchema>http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a</AcceptableResponseSchema>
    </Request>
</Autodiscover>

Then run:

curl -d @autod.xml -u username -H 'Content-Type: text/xml' -v https://autodiscover.example.com/autodiscover/autodiscover.xml

Banana Pi M3

Dell iDRAC

To upload an SSL certificate and key:

$ racadm -r <ip of idrac> -u <username> -p <password> sslkeyupload -t 1 -f filename.key
$ racadm -r <ip of idrac> -u <username> -p <password> sslcertupload -t 1 -f filename.cer

Ref: https://serverfault.com/questions/485426/install-existing-ssl-certificate-on-dell-idrac7/489927#489927

SureFeed Pet Feeder

Taken from Reddit: https://www.reddit.com/r/cats/comments/18oipjr/here_are_the_surefeed_microchip_feeder_custom/

Hey all. If you've had one of these feeders and wanted to try out custom settings you've likely learned that you have to either scour the internet or contact customer service, the latter of which can be hit or miss. After about 6 months of trying to get them to respond to me, I finally have the button combinations they gave me for two custom modes for the non-connect version of the SureFeed microchip feeder, detailed below for anyone else who will need or want it in the future:

Intruder mode:

  • Please put the Slide Switch into position II (Slide Switch setting II).
  • Press the Fn/Training and the ‘Add Pet’ buttons together until the red LED illuminates (approx. 10 seconds)
  • Press the Fn/Training button repeatedly until the LED shows orange (not flashing).*
  • The lights will cycle Static Red -->Static Green-->Static Orange.
  • Once the LED shows orange, press the Open / Close button to select Intruder Custom Mode.

If you go past Green keep pressing Fn to cycle through all the Custom Modes until the correct Custom Mode is reached again.

Forced Lid Closed mode

  • Please put the Slide Switch into position III (Slide Switch setting III).
  • Press the Fn/ Training and the ‘Add Pet’ buttons together until the red LED illuminates (approx. 10 seconds)
  • Press the Fn/ Training button repeatedly until the LED shows Green (not flashing).*
  • As you press the button the lights will cycle Static Red -->Static Green
  • Once the LED shows Green, press the Open / Close button to select Forced Lid Closed - Custom Mode.

If you go past Green keep pressing Fn to cycle through all the Custom Modes until the correct Custom Mode is reached again.

For both modes...

  • If you do not complete the steps above the unit will time out and return to normal operation after 60 seconds.
  • If you want the lid to close as fast as possible after your cat has eaten, please put the slider switch back to 1.

Forced Lid Closed mode is supposed to be more responsive I think, but I haven't personally noticed a difference between the two. Best of luck to other microchip feeder owners, here's hoping we get some viable alternatives from other companies in the future.

Ender 3 Pro

https://www.reddit.com/r/ender3/comments/13rj5go/recommended_settings_for_marlin_with_a_sprite/

The X carriage that comes with the Sprite Pro has screws holding the rollers that are too long. You need to replace the M5 30mm long buttonhead screws and nyloc nuts on the bottom and right most roller (as you look at the front of the printer) with M5 25mm long buttonhead screws and regular M5 nuts.

Note: The original post has *M4 instead of *M5 which is incorrect.

Dont forget to change your esteps to 424.9 & retraction to .8@45mm/s Ans adjust Z offset before printing!

Firmware: https://www.reddit.com/r/Ender3Pro/comments/11opbso/sprite_extruder_firmware_for_various_boards/

Some more firmware: https://drive.google.com/drive/folders/1pBJ5uNwQwNpY_2RczwzpbkbmnN9-epJI

BLTouch on SKR Mini – Install Guide: https://3dprintscape.com/bltouch-on-skr-mini-install-guide/

Ground Control Pro

Power supply information taken from the forums:

The power jack on a Ground Control Pro is a 2.5mm x 5.5mm Barrel. The Ground Control Pro comes with a 9VAC @ 500mA power supply, but it can be powered from 9V AC or DC source (polarity doesn't matter).

You want a power supply that can provide 9V AC or DC with a minimum current rating of 500mA.

Any Voodoo Lab dealer should be able to get you the appropriate power supply, but most won't likely have it shown in an online store.

Alternatively, you can give us a call or write to [email protected] to order the original power supply directly from us.

I hope that helps!

We have always used a full wave bridge rectifier setup on both the 5.5x2.5mm barrel connector and the Phantom Power input (pins 1 & 3, as well as pins 6 & 7, of the MIDI Out jack). A full wave bridge rectifier will accept AC or DC power, regardless of the polarity when using DC.

Team Fortress 2

Script to rocket jump with a sentry. Paste this into your engineer.cfg file:

//---------------------------------

bind "MOUSE2" "+attack2"
alias "+crouchjump" "+attack2; +jump; +duck"
alias "-crouchjump" "-attack2; -jump"
bind "o" +crouchjump

alias "+fire" "lastinv; +attack2"
alias "-fire" "-attack2; -duck"
bind "p" +fire

//------------------------------------

Press O then P quickly with wrangler out and facing your sentry.

Porsche Cayman S 981

Volkswagen Golf V R32

OEM Wheels: Omanyts Size: 7.5J x 18 ET51 Bolt Pattern: 5x112 Part Number: 1K0601025BL8Z8 Weight: 28 lbs Tire: 225/40 R18