Skip to content

Instantly share code, notes, and snippets.

View evilkost's full-sized avatar

Valentin Gologuzov evilkost

  • Czech Republic, Prague
View GitHub Profile
docker images -q --filter "dangling=true" | xargs docker rmi
touch -h -d '-100 day' --time=mtime /etc/mock/*
class RedisLogHandler(Process):
"""
Single point to collect logs through redis pub/sub and write
them through standard python logging lib
"""
def __init__(self, opts):
Process.__init__(self, name="log_handler")
PGPASSWORD=coprpass psql -a -h localhost -U copr-fe coprdb -c "\copy (select api_login, api_token from public.user where username='kost2') to '/tmp/credentionals.csv' with csv "
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
import os
from pwd import getpwnam
from grp import getgrnam
import logging
from subprocess import Popen, PIPE
from celery.contrib import rdb; rdb.set_trace()
@pytest.yield_fixture
def mc_logging():
with mock.patch("backend.daemons.log.logging") as mc_logging:
yield mc_logging
#!/usr/bin/python
import os
from time import sleep
import plumbum as pb
import plumbum.cli as cli
from plumbum.cmd import inotifywait
#!/bin/sh
for package in $@
do
echo "removing config files for $package"
for file in $(rpm -q --configfiles $package)
do
echo " removing $file"
rm -f $file
done
import os
class Writer(object):
def __init__(self, base_dir):
self.base_dir = base_dir
self.pool = {}
def _get_fh(self, name):
if name not in self.pool:
self.pool[name] = open(os.path.join(self.base_dir, name), "w")