Merge branch 'master' of waschsauger.bl0rg.net:dirty-helpers
commit
8817392d64
@ -1,3 +1,3 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# List XXXs, FIXMEs and TODOs in files
|
# List XXXs, FIXMEs and TODOs in files
|
||||||
ag '^(?!.*mktemp).*XXX|FIXME|TODO'
|
ag '^(?!.*mktemp).*XXX|FIXME|TODO' "$@"
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Find large files on this host
|
# 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 }'`
|
WHERE=`mount -t ext2,ext3,ext4,btrfs,ntfs,reiserfs,xfs,zfs | awk '{ print $3 }'`
|
||||||
IGNORE='^(/var/lib/rpm/Packages|/home/.*/.btsync/.*\.db)$'
|
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"
|
||||||
|
@ -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()
|
@ -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…
Reference in New Issue