View pass_recovery.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
# | |
# Raspberry PI password recovery for arch | |
# The SD should be mounted on $DEV (usually sdb2) | |
USER=root | |
PASSWORD=hola | |
DEV=sdb2 | |
# Creating SHA512 password for arch |
View firewall-sshd-limit.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# requires hashlimit | |
iptables -I INPUT -p tcp -m tcp --dport 22 -m state --state NEW \ | |
-m hashlimit --hashlimit 1/min \ | |
--hashlimit-burst 5 --hashlimit-mode srcip \ | |
--hashlimit-name SSH --hashlimit-htable-expire 120000 \ | |
-j ACCEPT | |
iptables -I INPUT -p tcp -m tcp --dport 22 \ |
View openvpn-new-client.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Create client for OpenVPN using easy-rsa | |
# create p12 certificate | |
PREFIX=lu | |
BASE_DIR="/etc/openvpn" | |
DEST_DIR="$BASE_DIR/clients" | |
EASY_DIR="$BASE_DIR/easy-rsa" | |
if [ "$#" -ne 1 ]; then |
View removing_GPT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Warning!! Unsupported GPT (GUID Partition Table) detected. Use GNU Parted | |
To go back to the normal MBR: | |
# parted /dev/sda | |
# mklabel msdos | |
# quit | |
Or, do it in a single line: | |
# parted -s -- /dev/sda mklabel msdos |
View 00-openvpn-bittorrent.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
By doing these steps, transmission will be listening only on the VPN interface/network. | |
As debian/ubuntu are now using systemd, the following instructions should work on those distros. | |
1) Copy all shell scripts to /usr/local/bin/ and make them executable | |
2) Copy systemd service unit to /etc/systemd/system/ | |
3) Install transmission: sudo pacman -Syu transmission-cli | |
4) Install openvpn: sudo pacman -Syu openvpn | |
5) Change transmission parameters: sudo vim /var/lib/transmission/.config/transmission-daemon/settings.json | |
6) Create the openvpn client configuration file: /etc/openvpn/client.conf | |
7) Enable the new service: sudo systemctl enable openvpn-bittorrent |
View public_ip.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
dev=$1 | |
ping -c 1 -I $dev ifconfig.me && \ | |
echo "Public ip: $(curl -s --interface $dev ifconfig.me/host) $(curl -s --interface $dev ifconfig.me/ip)" |
View remotevnc.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Script to connect to remote machine via ssh and export X11 via vnc using a ssh tunnel | |
# | |
# Author: Jose Riguera <jriguera@gmail.com> December 2009 | |
# License: GNU General Public License v2 or later | |
# | |
# x11vnc must be installed on remote host | |
# xvnc4viewer must be installed on local host | |
# |
View openstack_cli_create_tenant.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
TENANT=cf | |
PASSWORD=cf | |
TENANT_DESC="Cloud Foundry" | |
TENANT_EMAIL="cloud-foundry@springer.com" | |
TENANT_NET="10.0.1.0/24" | |
TENANT_NET_GW="10.0.1.1" | |
export OS_USERNAME=admin |
View s3.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.ByteArrayInputStream; | |
import java.io.File; | |
import java.util.List; | |
import com.amazonaws.auth.AWSCredentials; | |
import com.amazonaws.auth.BasicAWSCredentials; | |
import com.amazonaws.util.StringUtils; | |
import com.amazonaws.services.s3.AmazonS3; | |
import com.amazonaws.services.s3.AmazonS3Client; | |
import com.amazonaws.services.s3.model.Bucket; | |
import com.amazonaws.services.s3.model.CannedAccessControlList; |
View openstack_cli_ironic.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Create the initial ramdkisk | |
export ELEMENTS_PATH="/home/jriguera/diskimage-builder/elements" | |
ramdisk-image-create ubuntu deploy-ironic grub-install -o my-deploy-ramdisk | |
# Create the image to deploy on disk (with ConfigDrive support) | |
DIB_CLOUD_INIT_DATASOURCES="ConfigDrive, OpenStack" disk-image-create ubuntu baremetal dhcp-all-interfaces -o my-image | |
# Define the parameter for the new server |
OlderNewer