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
#include <stdlib.h> | |
#include <sys/types.h> | |
#include <stdio.h> | |
int main(int argc, char *argv[]) { | |
printf("Alert!\a\n"); | |
return 0; | |
} |
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 | |
# File CSV di esempio | |
# Dettaglio spese relative al Numero di telefono 123456789123 per il periodo dal 04/04/2008 al 03/05/2008 | |
#Altro,,1231***,03/05/2008 15:20:15,00:00:01,0.00000 | |
#Servizi di messaggistica,Voda,1234453***,01/05/2008 19:26:07,,0.15000 | |
#Chiamate voce e video,Voda,1234453***,19/04/2008 17:25:45,00:00:20,0.18340 | |
#Servizi di messaggistica,Voda,1234453***,19/04/2008 09:43:54,,0.15000 | |
# Controlla che ci sia un argomento |
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 | |
# Script che controlla gli accessi effetuati, i logout | |
# degli utenti e i tentativi di accesso di root FALLITI: | |
# in presenza di tali eventi verra' inviata una mail | |
# contenente la parte di log interessata al recipiente specificato | |
# Cron di esempio: */5 * * * * /home/root/check_log.sh | |
# Configurazioni |
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 ftplib | |
import os | |
def scarica_cartella(host,user,password,cartella_richiesta,destinazione="./"): | |
try: | |
ftpp=ftplib.FTP(host,user,password) | |
except: | |
print "connessione non riuscita" | |
ftpp.close() | |
else: |
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 serial | |
import sys | |
# see http://dmt195.wordpress.com/2009/01/19/python-to-interface-with-the-pololu-8-channel-servo-controller/ | |
#set up the serial port for action (0==COM1==ttyS0) | |
ser=serial.Serial(1) | |
ser.baudrate=2400 | |
def setpos(n,angle): |
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
#include <sys/types.h> | |
#include <sys/socket.h> | |
#include <netinet/in.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <string.h> | |
#define SRV_PORT 32100 | |
#define MAX_CLIENT 5 |
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 | |
updatedb; | |
for remove in `cat pattern_file_list.txt`; do | |
for file in `locate $remove | grep "$remove$"`; do | |
rm -v \"$file\" | |
done | |
done |
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 | |
ris=`who | grep -c ""` | |
if [ "$ris" == "0" ]; then | |
echo "Non c'e' nessuno loggato! Spegno<br />`ps aux`" | mail -s "Spegnimento... " root | |
sleep 10s | |
/sbin/shutdown -h 10 | |
else | |
echo "C'e' ancora qualcuno loggato: `who -H`" | mail -s "Spegnimento... FAILED" root | |
/sbin/shutdown -c now |
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 | |
t=`cat /proc/acpi/thermal_zone/THRM/temperature | cut -c26-27` | |
let t=$t+0 | |
# CREATE TABLE temperature ( d DATETIME, t DECIMAL(12,12) ) | |
q="INSERT INTO temperature VALUES(NOW(),'$t');" | |
echo $q | mysql -h "<DATABASE-HOST>" -u "<USERNAME>" "<DATABASE>" |
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 | |
# http://www.raspberrypi.org/forums/viewtopic.php?t=30670 | |
#temp=`cat /proc/acpi/thermal_zone/THRM/temperature | cut -c26-27` | |
temp="`cat /sys/class/thermal/thermal_zone0/temp`" | |
let tempint=$temp/1000 | |
tempfloat="`bc -l <<< \"scale=2; $temp/1000\"`" | |
debug="$1" |