2 new scripts added : ridof_cursor.py nd do_nat.sh

This commit is contained in:
Nicolas Wavrant 2015-12-20 15:52:41 +01:00
parent ee34d92f39
commit 8b975a0502
3 changed files with 32 additions and 0 deletions

View File

@ -7,6 +7,8 @@ I upload it here first to easily find whenever I will need them again, but also
# Scripts
* __no_ip.sh__ : this script will send you an email containing the public IP of the device on which it is run. Very useful if you have a server home (or a simple device as a raspberry pi), and don't want to suscribe to a no-ip service. Installation is very simple : adds a cron rule. This interesting thing in this script is that it will send you an email *only* if your address has changed.
* __do_nat.sh__ : bash script to set up a NAT functionnality between 2 given network interfaces.
* __ridof_cursor.py__ : move the cursor in a X window manager to remove it from sight, in the respect of the tiling window managers' philosophy.
# Configs

17
scripts/do_nat.sh Normal file
View File

@ -0,0 +1,17 @@
#!/bin/bash
# This script set up a NAT on your network interfaces
# It can be used to allow your virtual machines to connect to the internet,
# regardless of you virtualization technology.
# Interfaces can be bridges.
if [ $# -ne 2 ]
then
echo "run like this : do_nat.sh INTERFACE_IN INTERFACE_OUT"
exit 1
fi
echo 1 > /proc/sys/net/ipv4/ip_forward
/sbin/iptables -t nat -A POSTROUTING -o $2 -j MASQUERADE
/sbin/iptables -A FORWARD -i $2 -o $1 -m state --state RELATED,ESTABLISHED -j ACCEPT
/sbin/iptables -A FORWARD -i $1 -o $2 -j ACCEPT

13
scripts/ridof_cursor.py Normal file
View File

@ -0,0 +1,13 @@
#!/usr/bin/python
# Move the cursor of your X window system out of sight
# (in the middle, down of the screen)
# It uses the low level python Xlib.
from Xlib import X, display
d = display.Display()
s = d.screen()
root = s.root
root.warp_pointer(s['width_in_pixels']/2 , s['height_in_pixels'])
d.sync()