Skip to content

Instantly share code, notes, and snippets.

View AlexBaranowski's full-sized avatar

Aleksander Baranowski AlexBaranowski

View GitHub Profile
#!/usr/bin/env bash
# This script adds EuroLinux 6.10 vault repos
if [ $EUID -ne 0 ]; then
echo "This script must be run as root"
exit 1
fi
@AlexBaranowski
AlexBaranowski / eurolinux-7-9-vault-repos.sh
Last active July 1, 2024 09:09
Add/Enable EuroLinux 7.9 Vault Repositories
#!/usr/bin/env bash
if [ $EUID -ne 0 ]; then
echo "This script must be run as root"
exit 1
fi
[ -e /etc/pki/rpm-gpg/RPM-GPG-KEY-eurolinux7 ] || curl -o /etc/pki/rpm-gpg/RPM-GPG-KEY-eurolinux7 https://fbi.cdn.euro-linux.com/security/RPM-GPG-KEY-eurolinux7
@AlexBaranowski
AlexBaranowski / centos-stream-8-vault-repos.sh
Last active November 4, 2024 14:44
Replace CentOS Stream 8 repos with CentOS Stream 8 VAULT repos
cat > /etc/yum.repos.d/CentOS-Stream-AppStream.repo << EOF
# CentOS-Stream-AppStream.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are geographically
# close to the client. You should use this for CentOS updates unless you are
# manually picking other mirrors.
#
# If the mirrorlist does not work for you, you can try the commented out
# baseurl line instead.
@AlexBaranowski
AlexBaranowski / remove_all_github_repos.py
Created May 31, 2023 08:06
Removes ALL GitHub repositories for selected organization. Requires Access Token (provided by env variable GH_TOKEN) with admin right/delete repositories rights. Scripts uses python requests and os module only.
import requests
import os
GH_TOKEN = os.environ['GH_TOKEN']
GH_HEADERS = {"Accept": "application/vnd.github+json",
"Authorization": f"Bearer {GH_TOKEN}",
"X-GitHub-Api-Version": "2022-11-28"}
ORG_NAME = "TODO-FIXME-YOUR-ORG-NAME"
REPO_SET=set()
@AlexBaranowski
AlexBaranowski / check-x86_64-microarch.sh
Created October 4, 2022 08:53
Checking the x86_64 microarchitecture
#!/usr/bin/env bash
# Author: Alex Baranowski
# License: MIT
set -e
# we only need first flag line for the cpu
cpu_flags=$(grep '^flags\b' /proc/cpuinfo | head -n 1)
echo -e "supported cpu flags:\n$cpu_flags"
@AlexBaranowski
AlexBaranowski / migrate-to-centos-vault.sh
Created February 14, 2022 13:25
This trivial script migrate CentOS 8 repos to CentOS 8 vault repos
#!/usr/bin/env bash
cat > /etc/yum.repos.d/CentOS-Linux-AppStream.repo << EOF
# CentOS-Linux-AppStream.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are geographically
# close to the client. You should use this for CentOS updates unless you are
# manually picking other mirrors.
#
# If the mirrorlist does not work for you, you can try the commented out
@AlexBaranowski
AlexBaranowski / swap-check.sh
Created January 18, 2022 16:06
Simple script to check how many swaps can your Linux run.
#!/usr/bin/env bash
# Author: Alex Baranowski
# License: MIT
# Max swap files tester
# magic number: 33 -> in theory 32 swap file on Linux can be used 33 = 32+1
echo "Deactivating all swaps that are used"
sudo swapoff -a
@AlexBaranowski
AlexBaranowski / nappo.py
Created January 4, 2022 12:01 — forked from omajid/nappo.py
nappo
#!/usr/bin/python3
# Copyright © 2021 Red Hat, Inc
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@AlexBaranowski
AlexBaranowski / loadavg.c
Last active November 4, 2020 17:08
loadavg.c
#include<sys/sysinfo.h>
#include<stdio.h>
// NOTE: FSHIFT might differ
#define FSHIFT 16
#define FIXED_1 (1<<FSHIFT) /* 1.0 as fixed-point */
#define LOAD_INT(x) ((x) >> FSHIFT)
#define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100)
#include<stdio.h>
int main(){
int i, j;
for (i=0; i < 100000;i++){
for (j=0; j < 100000;j++){
}
}
printf("Finish!");
}