Skip to content

Instantly share code, notes, and snippets.

View AlexBaranowski's full-sized avatar

Aleksander Baranowski AlexBaranowski

View GitHub Profile
@AlexBaranowski
AlexBaranowski / remove_id.py
Created July 18, 2016 12:49
Sattelite remove id
#!/usr/bin/env python2
'''
Red Hat satellite 5.x script for unregister system(s)
sample usage:
./remove_id.py -i 1001440837 1001440835 -u satadmin -p redhat
'''
import argparse
import xmlrpclib
import socket
config.vm.provider "libvirt" do |vb|
# Customize the amount of memory on the VM:
vb.memory = 4096
vb.cpus = 2
end
@AlexBaranowski
AlexBaranowski / openssl-endecrypt.md
Created May 16, 2017 09:51
Very simple encryption with password using openssl command

Encrypt

openssl aes-256-cbc -in some_pdf.pdf  -out encrypted.pdf

Decrypt

openssl aes-256-cbc -d -in encrypted.pdf -out some_pdf_decrypted.pdf
find ./ -mtime +{$1} -exec rm {} \;
@AlexBaranowski
AlexBaranowski / v_simple.sh
Last active April 6, 2018 10:39
BASH - check as root and command
#!/bin/bash
#
# name: TODO_NAME
#
# description:TODO_DESC
# default log file: /var/log/TODO_LOG
#
# Copyright 2016 TODO, Inc.
# TODO_NAME <TODO_MAIL>
#
@AlexBaranowski
AlexBaranowski / find_all_req.sh
Last active December 11, 2017 15:23
Find all python import in given directory with find && grep.
find . -name '*\.py' -exec grep '^import ' {} \; | sort | uniq > req
@AlexBaranowski
AlexBaranowski / redshift.conf
Created December 19, 2017 00:30
My redshift conf
; Mostly taken from http://jonls.dk/redshift/
; Global settings for redshift
[redshift]
; Set the day and night screen temperatures
temp-day=5700
temp-night=3200
; Enable/Disable a smooth transition between day and night
; 0 will cause a direct change from day to night screen temperature.
; 1 will gradually increase or decrease the screen temperature.
@AlexBaranowski
AlexBaranowski / merge_to_tuple.py
Created December 30, 2017 23:14
Very simple merging two files with same line - idea is to make tuple that will be hardcoded.
with open('some_args') as f1:
with open('some_names') as f2:
with open('out', 'w') as f3:
args = f1.readlines()
name = f2.readlines()
print('lenghts :', len(args), len(name))
for i in range(len(args)):
f3.write('(\'{}\', \'{}\'),\n'.format(args[i].strip(), name[i].strip()))
@AlexBaranowski
AlexBaranowski / remove_not_used.sh
Created January 15, 2018 20:14
Remove not used packages from pip requirements.txt
#!/bin/bash
diff requirements.txt requirements.txt2 | awk '{print $2}' | xargs pip uninstall -y
@AlexBaranowski
AlexBaranowski / install_newest_git.sh
Last active April 13, 2018 09:50
Install the newest GIT on EuroLinux/Scientific Linux/RHEL/Oracle Linux/CentOS/. Taken from this article: https://pl.euro-linux.com/git-podstawowe-narzedzie-pracy-dewelopera-czesc-ii-troche-komend-troche-praktyki/
#!/bin/bash
# The MIT License (MIT)
# Copyright (c) 2017 EuroLinux
# Author: Alex Baranowski
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions: