Skip to content

Instantly share code, notes, and snippets.

View carlesloriente's full-sized avatar
🎾
Eagle eye mode

Carles Loriente carlesloriente

🎾
Eagle eye mode
View GitHub Profile
@carlesloriente
carlesloriente / IAM Policy account accessed
Last active February 8, 2024 01:05
AWS Switch role between accounts (Administrator access)
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::ACCESSED_ACCOUNT_ID:root"
},
"Action": "sts:AssumeRole",
"Condition": {}
@carlesloriente
carlesloriente / fedora-fix-touchpad_msi-prestige.sh
Last active February 8, 2024 01:05
Fedora Fix Touchpad MSI Prestige
alias fixtouchpad='sudo rmmod i2c_hid; sudo modprobe i2c_hid'
@carlesloriente
carlesloriente / create-linux-swap-file.sh
Last active February 8, 2024 01:06
Create a linux swap file
sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=2M count=2048
sudo /sbin/mkswap /var/swap.1
sudo /sbin/swapon /var/swap.1
sudo chmod 0600 /var/swap.1
@carlesloriente
carlesloriente / format-and-mount-nvme-volumes.sh
Last active February 8, 2024 01:06
Format and mount an NVMe Volume
sudo yum -y install nvme-cli;
sudo mkfs.xfs /dev/nvme1n1;
sudo mkdir -p /mnt/ephemeral;
sudo mount /dev/nvme1n1 /mnt/ephemeral;
sudo chown centos:centos /mnt/ephemeral;
@carlesloriente
carlesloriente / mikrotik-routeros_export-config-file-and-sent-email.rsc
Last active February 8, 2024 01:06
Routeros export config file and sent to email addres
/export file=export
/tool e-mail send to="[email protected]" subject=([/system identity get name] . " Export " . [/system clock get date]) body="([/system clock get date] configuration file)" file=export.rsc
@carlesloriente
carlesloriente / compile-and-install-glibc_2.18-centos-7.sh
Last active April 22, 2024 03:17
Compile and install GLIBC 2.18 in CentOS 7
# Check gist comments to verify system PATH and or adapt it.
wget https://ftp.gnu.org/gnu/glibc/glibc-2.18.tar.gz
tar zxvf glibc-2.18.tar.gz
cd glibc-2.18
mkdir build
cd build
../configure --prefix=/opt/glibc-2.18
make -j4
sudo make install
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/glibc-2.18/lib
@carlesloriente
carlesloriente / add-git-submodule.sh
Last active February 8, 2024 01:07
Add submodule Git
git submodule add [email protected]:user/repo a/submodule
git submodule update --init --recursive
@carlesloriente
carlesloriente / delete-git-submodule.sh
Last active February 8, 2024 01:07
Delete submodule Git
git submodule deinit -f -- a/submodule
rm -rf .git/modules/a/submodule
git rm -f a/submodule
@carlesloriente
carlesloriente / icinga_apache_vhost.conf
Last active February 8, 2024 01:08
Apache virtualhost for Icinga2
<VirtualHost *:80>
ServerName yourdomain.com
DocumentRoot /usr/share/icingaweb2/public
RedirectMatch permanent "^/$" "http://yourdomain.com/icingaweb2/"
Alias /icingaweb2 "/usr/share/icingaweb2/public"
<Directory "/usr/share/icingaweb2/public">
Options SymLinksIfOwnerMatch
AllowOverride None
@carlesloriente
carlesloriente / upload_files_to_s3_using_aws_sdk.php
Last active February 8, 2024 01:08
A simple PHP script for upload files to s3 using AWS SDK
<?php
require_once '../private/config.php';
require_once $CONF->private . 'Project.php';
require_once $CONF->lib . 'aws/aws-autoloader.php';
define('AWS_KEY', $CONF->AWS_KEY);
define('AWS_SECRET_KEY', $CONF->AWS_SECRET_KEY);
define('HOST', 'https://s3.amazonaws.com/');
use Aws\S3\S3Client;