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 / flush_cache_kill_dnsresponder.bash
Created August 6, 2023 14:56
MacOs flushcache and kill mDNSResponder
#!/bin/bash
sudo dscacheutil -flushcache;
sudo killall -HUP mDNSResponder;
sleep 2;
@carlesloriente
carlesloriente / .gitignore
Last active August 16, 2023 06:32
Default .gitignore for local macos development
#Local dev env and testing
cfn-templates/parameters.local
.env
.kitchen/
.kitchen.local.yml
.vagrant
.venv
yarn_npm_package/*/node_modules
env/
venv/
#!/bin/bash
# Full script for fixing homebrew update error
# Reset
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
# Reset homebrew-cask
brew untap homebrew/homebrew-cask - -force
brew reinstall cask
@carlesloriente
carlesloriente / fedora-configure-and-setup-ikev2.sh
Last active February 8, 2024 01:12
configure-and-setup-ikev2.sh
#!/bin/bash
sudo dnf remove -y strongswan NetworkManager-strongswan NetworkManager-strongswan-gnome strongswan-libipsec
sudo dnf install -y libreswan NetworkManager-libreswan NetworkManager-libreswan-gnome ldns nss-tools firewall-config
echo "Changing ipsec.conf"
sudo sed -i 's/# dnssec-enable=no/dnssec-enable=no/g' /etc/ipsec.conf
sudo sed -i 's/#DNSSEC=allow-downgrade/DNSSEC=false/g' /etc/systemd/resolved.conf
echo "Configuring Firewall"
# Certificate creation for users
/certificate add [email protected] [email protected] [email protected] subject-alt-name=email:[email protected]
/certificate sign [email protected] ca=CA.yourdomain.com
/certificate export-certificate [email protected] type=pkcs12 export-passphrase=YOURPASSPHRASE
/ip ipsec identity add auth-method=digital-signature certificate=vpn.yourdomain.com [email protected] generate-policy=port-strict match-by=certificate mode-config="modeconf vpn.yourdomain.com" peer="peer 1.1.1.1" policy-template-group="group vpn.yourdomain.com" remote-id=user-fqdn:[email protected]
@carlesloriente
carlesloriente / mikrotik_routeros_vpn-ikev2-ipsec.rsc
Last active February 8, 2024 01:11
mikrotik_routeros_vpn-ikev2-ipsec.rsc
# Mikrotik RouterOs IKEv2/IPSec VPN Full configuration
# RouterOS v6.45+
/system identity
set name=mikrotik_aws_vpn_ikev2
/system clock
set time-zone-name=Europe/Dublin
/system ntp client
@carlesloriente
carlesloriente / mikrotik_routeros_vpn-pptp.rsc
Created August 2, 2020 15:21
Mikrotik RouterOs PPTP VPN Full configuration
# Mikrotik RouterOs PPTP VPN Full configuration
#
/interface bridge
add fast-forward=no name=bridge
/interface ethernet
set [ find default-name=ether1 ] advertise=10M-half,10M-full,100M-half,100M-full,1000M-half,1000M-full
/interface bridge port
@carlesloriente
carlesloriente / mikrotik_routeros_vpn-l2tp-ipsec.rsc
Last active July 2, 2024 13:02
Mikrotik RouterOs L2TP/IPSec VPN Full configuration
# Mikrotik RouterOs L2TP/IPSec VPN Full configuration
#
/interface bridge
add fast-forward=no name=bridge
/interface ethernet
set [ find default-name=ether1 ] advertise=10M-half,10M-full,100M-half,100M-full,1000M-half,1000M-full
/interface bridge port
@carlesloriente
carlesloriente / install_nvidia_drivers_ec2_centos.sh
Last active February 8, 2024 01:08
Install Nvidia drivers on EC2 Instance with CentOS
#!/bin/bash
sudo yum -y install gcc kernel kernel-devel tbb tbb-devel
echo "Download and install AWS NVIDIA GPU Drivers";
curl -o NVIDIA.run https://s3.amazonaws.com/ec2-linux-nvidia-drivers/grid-10.0/NVIDIA-Linux-x86_64-440.43-grid.run
sudo /bin/sh ./NVIDIA.run
@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;