Skip to content

Instantly share code, notes, and snippets.

@anerdev
anerdev / main.py
Created November 5, 2019 11:58
multiple website, multiple files to generate and upload
import ftplib
import os
import fileinput
import csv
# col1 = url (google.com), col2 = ftp host, col3 = ftp user, col4 = ftp password
with open('ftp.csv', 'rb') as csvfile:
ftp_records = csv.reader(csvfile, delimiter=',')
Copy securelly file between folders
sudo rsync -vaE --progress /Volumes/source /Volumes/destination
@anerdev
anerdev / gps-split-time-sscanf.ino
Last active August 29, 2015 14:17
SIM900/908 split char "time" values. Version using sscanf
/*
The library for the SIM900/908 Shield by Futura Elettronica from gsmlib.org have the char "time" output in this format: "20150226193522.001"
This is a sketch for split the char "time" values like this: 2015 (year) 02 (month) 26 (day) 19 (hours) 35 (minutes) 22 (seconds).
The part ".001" not needed.
This is the version that use "sscanf" method.
Thanks to: jurs from arduino.cc forum: http://forum.arduino.cc/index.php?topic=303515
Arduino GSM GPRS and GPS Shield from Futura Elettronica: http://www.open-electronics.org/gsm-gps-shield-for-arduino/
Library for the Shield: http://www.gsmlib.org/
@anerdev
anerdev / gps-split-time-genericsplit.ino
Last active August 29, 2015 14:17
SIM900/908 split char "time" values. Version using a generic splitting method.
/*
The library for the SIM900/908 Shield by Futura Elettronica from gsmlib.org have the char "time" output in this format: "20150226193522.001"
This is a sketch for split the char "time" values like this: 2015 (year) 02 (month) 26 (day) 19 (hours) 35 (minutes) 22 (seconds).
The part ".001" not needed.
This is the version that use a generic splitting method.
Thanks to: KenF from arduino.cc forum: http://forum.arduino.cc/index.php?topic=303515
Arduino GSM GPRS and GPS Shield from Futura Elettronica: http://www.open-electronics.org/gsm-gps-shield-for-arduino/
Library for the Shield: http://www.gsmlib.org/
@anerdev
anerdev / php_redirect_based_ip.php
Created March 14, 2014 16:10
Php redirect based from ip
<?php
$ip = explode(".", $_SERVER['REMOTE_ADDR']); // Save in the array "ip" the octects of the ip
if ($ip[0] == 192) { // read the first octect, and for example, if you are from the internal lan, where the pc's ip start with "192" redirect to "index_lan.html"
header("location: index_lan.html");
}
else { // if the ip doesn't start with 192, redirect to "index_wan.html"
header("location: index_wan.html");
};