Skip to content

Instantly share code, notes, and snippets.

@bitsandbooks
bitsandbooks / update-container.sh
Last active September 18, 2018 00:02
Update Tautulli Docker Container
#!/bin/sh
# by Rob Dumas
# When Tautulli tells me there's a new version available, I run this
# shell sript to remove the old container and create a new one.
# License: 2-clause BSD
CONTAINER_NAME="mycontainer"
CONTAINER_ID=$(docker ps -aqf "name=$CONTAINER_NAME")
CONTAINER_UID=1000
CONTAINER_GID=2000
# Public key for rdumas@egvpl.org
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBFvFOrIBEADeKGpBMxO2zgUjcRWg7xCgi1Z23DIJgZe81Rkfvq8axDyuEC40
XrUSL+i8ziXaTyQwPTFmKP/2HNhXFPl+ZzjYEGblw2nUtwusegiQOzyD1VUv2LRP
wUHk5sdiNTwed/qQuu3hzXsf2A3TrGUgw+1G80jLqNRHCZzwVf3a//OGIcHTR1JC
R/GdD1oly6jzQw9tWtzXiUZvEC0MlHYdhxFWXaZCrWSoMbahQLx79mD8zm8NZOKE
FQyo7Hk8aq1o5uCHA/z6v6ui1tg6jOuQSdFPzHGNM0iKRiu/ThvCgQwbX327tAmt
ldb88LqRAqDvj7zfNIqFSuQvnlVRGe5HpNiRi+GZ73ksODEEQjtjOcm+TnjOri2r
jLees36lFLPaxaIXnO//uPG6lZw1sBsc2DoYRV4Fau2z4LcBEaYCztEdAfeD4iu2
---
- name: ensure presence of user
user:
name: "{{ item.username }}"
uid: "{{ item.username }}"
password: "{{ item.passwd }}"
comment: "{{ item.comment }}"
shell: "{{ item.shell }}"
group: "{{ item.group }}"
groups: "{{ item.groups }}""
#cloud-config
groups:
- foo
users:
- default # use the default users/groups that come with this o.s.
- name: bar # create a user named bar
gecos: Bar User # comment field. use for full name, room number, etc.
primary-group: foo # set bar's primary group to foo
groups: sudo # also add bar to the sudo group
@bitsandbooks
bitsandbooks / bootstrap-cloud.sh
Last active February 7, 2018 05:55
Server Bootstrapper
#!/bin/sh
/usr/bin/apt update
/usr/bin/apt -y upgrade
/usr/bin/apt install -y ansible
/usr/bin/apt -y autoremove
import os
import time
import subprocess
import sys
fileList = []
rootdir = raw_input("Root Dir: ")
for root, subFolders, files in os.walk(rootdir):
for file in files:
theFile = os.path.join(root,file)
@bitsandbooks
bitsandbooks / lastbusers.txt
Last active December 16, 2016 21:56
Lastb Failed Users
List of Usernames and # of Attempts to
Log In Over the Last Few Weeks
Att, User
– – – – –
4974 root
320 admin
316 oracle
248 test
218 postgres
@bitsandbooks
bitsandbooks / template.php
Created August 9, 2016 03:22
Template Example
<?php
/**
* @file
* template.php
*/
function sitename_menu_tree__menu_block__1(array $variables) {
return '<ul class="menu">' . $variables['tree'] . '</ul>';
}
[username@machine ~]# lastb
root ssh:notty 46.100.50.143 Wed Mar 9 07:45 - 07:45 (00:00)
root ssh:notty 125.88.177.87 Wed Mar 9 07:30 - 07:30 (00:00)
root ssh:notty 125.88.177.87 Wed Mar 9 07:30 - 07:30 (00:00)
root ssh:notty 125.88.177.87 Wed Mar 9 07:30 - 07:30 (00:00)
root ssh:notty 125.88.177.87 Wed Mar 9 07:30 - 07:30 (00:00)
root ssh:notty 125.88.177.87 Wed Mar 9 07:30 - 07:30 (00:00)
root ssh:notty 125.88.177.87 Wed Mar 9 07:30 - 07:30 (00:00)
root ssh:notty 125.88.177.87 Wed Mar 9 07:30 - 07:30 (00:00)
root ssh:notty 125.88.177.87 Wed Mar 9 07:30 - 07:30 (00:00)
@bitsandbooks
bitsandbooks / courses-slash-detail.html
Created January 24, 2016 04:41
Django static and media folders
<h1>{{ course.name }}</h1>
<p><strong>Description:</strong> {{ course.description }}</p>
<p><strong>Student Type:</strong> {{ course.get_student_type_display }}</p>
<p><strong>Image</strong> /{{ course.featured_image.url }}<br>
<img src="/{{ course.featured_image.url }}"></p>
<p><strong>Instructor:</strong> {{ course.instructor }}</p>