Merge branch 'master' of waschsauger.bl0rg.net:dirty-helpers
This commit is contained in:
commit
8817392d64
9 changed files with 68 additions and 8 deletions
2
XXX
2
XXX
|
@ -1,3 +1,3 @@
|
|||
#!/bin/sh
|
||||
# List XXXs, FIXMEs and TODOs in files
|
||||
ag '^(?!.*mktemp).*XXX|FIXME|TODO'
|
||||
ag '^(?!.*mktemp).*XXX|FIXME|TODO' "$@"
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
"""Check Docker images for security/distro updates. Assumes DNF."""
|
||||
|
||||
from __future__ import division, print_function
|
||||
from docker import Client
|
||||
import docker
|
||||
import subprocess
|
||||
|
||||
c = Client(base_url='unix://var/run/docker.sock')
|
||||
c = docker.APIClient(base_url='unix://var/run/docker.sock')
|
||||
for container in c.containers():
|
||||
name = container['Names'][0]
|
||||
id_ = container['Id']
|
||||
|
|
|
@ -7,7 +7,7 @@ import systemd.journal as journal
|
|||
|
||||
yesterday = datetime.datetime.today() - datetime.timedelta(1)
|
||||
SINCE = yesterday
|
||||
MINCOUNT = 5
|
||||
MINCOUNT = 20
|
||||
|
||||
|
||||
j = journal.Reader()
|
||||
|
|
1
gen-yum
1
gen-yum
|
@ -7,6 +7,7 @@ eval BASE_DIRS=~/www_static/dnf.bl0rg.net/*/*
|
|||
set -e
|
||||
|
||||
for base_dir in $BASE_DIRS; do
|
||||
restorecon -Rv $base_dir
|
||||
for YUM in $base_dir/{SRPMS,i386,x86_64}; do
|
||||
if [ -d $YUM ]; then
|
||||
echo "== $YUM"
|
||||
|
|
|
@ -15,6 +15,8 @@ import subprocess
|
|||
|
||||
def git_directories(startdir):
|
||||
for dirpath, dirnames, _ in os.walk(startdir):
|
||||
if '.sync' in dirpath:
|
||||
continue
|
||||
if set(['info', 'objects', 'refs']).issubset(set(dirnames)):
|
||||
yield dirpath
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#!/bin/sh
|
||||
# Find large files on this host
|
||||
|
||||
LARGE='+100M'
|
||||
LARGE=${1:-100M}
|
||||
WHERE=`mount -t ext2,ext3,ext4,btrfs,ntfs,reiserfs,xfs,zfs | awk '{ print $3 }'`
|
||||
IGNORE='^(/var/lib/rpm/Packages|/home/.*/.btsync/.*\.db)$'
|
||||
|
||||
sudo find $WHERE -xdev -size $LARGE | grep --line-buffered -Ev "$IGNORE"
|
||||
sudo find $WHERE -xdev -size +$LARGE | grep --line-buffered -Ev "$IGNORE"
|
||||
|
|
19
libvirt-restart-running
Executable file
19
libvirt-restart-running
Executable file
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/python
|
||||
# Restart all running libvirt domains
|
||||
|
||||
from __future__ import division, print_function
|
||||
|
||||
import libvirt
|
||||
import sys
|
||||
|
||||
conn = libvirt.open('qemu:///system')
|
||||
if not conn:
|
||||
print('Failed to open connection to the hypervisor!')
|
||||
sys.exit(1)
|
||||
|
||||
for domain in conn.listAllDomains():
|
||||
name = domain.name()
|
||||
if domain.isActive():
|
||||
print('Restarting {}...'.format(name))
|
||||
domain.destroyFlags(flags=libvirt.VIR_DOMAIN_DESTROY_GRACEFUL)
|
||||
domain.create()
|
11
maildir-zero
11
maildir-zero
|
@ -67,8 +67,15 @@ else:
|
|||
key = lambda i: i[0]
|
||||
reverse = False
|
||||
|
||||
length_name = max(len(name) for name in counts.keys())
|
||||
length_count = max(len(str(count)) for count in counts.values())
|
||||
try:
|
||||
length_name = max(len(name) for name in counts.keys())
|
||||
except:
|
||||
length_name = len('Total')
|
||||
try:
|
||||
length_count = max(len(str(count)) for count in counts.values())
|
||||
except:
|
||||
length_count = 3
|
||||
|
||||
for name, count in sorted(counts.items(), key=key, reverse=reverse):
|
||||
print('{0:{1}}\t{2:{3}d}'.format(name, length_name, count, length_count))
|
||||
|
||||
|
|
31
search-nulls
Executable file
31
search-nulls
Executable file
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/env python
|
||||
"""Find files starting with null bytes"""
|
||||
|
||||
from __future__ import division, print_function
|
||||
import argparse
|
||||
import os
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Find files starting with null bytes')
|
||||
parser.add_argument(
|
||||
'directories', metavar='dir', default=['.'], nargs='*',
|
||||
type=str, help='directory to be searched')
|
||||
parser.add_argument(
|
||||
'-n', dest='nullbytes', default=16,
|
||||
type=int, help='number of null bytes')
|
||||
args = parser.parse_args()
|
||||
|
||||
|
||||
for directory in args.directories:
|
||||
for dirpath, _, filenames in os.walk(directory):
|
||||
for filename in filenames:
|
||||
filename = os.path.join(dirpath, filename)
|
||||
|
||||
if not os.path.isfile(filename):
|
||||
continue
|
||||
|
||||
with open(filename, 'rb') as f:
|
||||
firstbytes = f.read(args.nullbytes)
|
||||
if firstbytes == b'\0'*args.nullbytes:
|
||||
print(filename)
|
Loading…
Add table
Add a link
Reference in a new issue