Skip to content

Instantly share code, notes, and snippets.

View alex-1q84's full-sized avatar
🎯
Focusing

dahai alex-1q84

🎯
Focusing
View GitHub Profile
@alex-1q84
alex-1q84 / rsync-usb.sh
Last active October 26, 2022 03:31 — forked from ground-creative/rsync-usb.sh
auto backup files to usb device using rsync
#!/bin/bash
####### RSYNC AUTO BACKUP TO USB DEVICE V0.5 ##########
####### Developed by Carlo Pietrobattista ###########
### CONFIG VARS #####################################
LOCK_FILE="/tmp/rsync-usb.pid" # the lock file name
MOUNT_DEV="/dev/sdh1" # mount device
MOUNT_PATH="/mnt/autobackup-usb" # mount point
BACKUP_DIR="/home/*" # backup directory
RSYNC_LOG_FILE="/var/log/rsync/usb_backup.log" # rsync log file
#####################################################
@alex-1q84
alex-1q84 / Python TCP Client Example.py
Created August 20, 2019 07:51 — forked from Integralist/Python TCP Client Example.py
Python TCP Client Server Example
import socket
hostname, sld, tld, port = 'www', 'integralist', 'co.uk', 80
target = '{}.{}.{}'.format(hostname, sld, tld)
# create an ipv4 (AF_INET) socket object using the tcp protocol (SOCK_STREAM)
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# connect the client
# client.connect((target, port))