require "socket"
server = TCPServer.open(2626)
loop do
Thread.fork(server.accept) do |client|
client.puts("Hello, I'm Ruby TCP server", "I'm disconnecting, bye :*")
This file contains hidden or 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 | |
DHCLIENTCONF_FILE="/etc/dhcp3/dhclient.conf" | |
#Prepend Opendns name-servers into DHCLIENTCONF_FILE | |
if [ "$(id -u)" -ne 0 ]; then | |
echo "Must be run as root" | |
exit 1 | |
fi | |
if [ "$(egrep '^prepend domain-name-servers' $DHCLIENTCONF_FILE | wc -l)" -ne 0 ]; then |
This file contains hidden or 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 | |
CURR_DIR="$(basename $PWD)" | |
BCKP_FILE="$HOME"/"$CURR_DIR""_Backup_""$(date +%F_%T)"".zip" | |
echo "..Starting executing" | |
echo "..Going to backup the current directory ('$CURR_DIR') into" | |
echo " $BCKP_FILE" | |
echo -n "---> Continue [Y/n] ? " && read CONTINUE | |
[ -z "$(echo $CONTINUE| grep -i 'y')" ] && echo "..Aborting" && exit 1 | |
cd .. && zip -9r $BCKP_FILE "$CURR_DIR" | sed -u 's/^/.... /g' |