Skip to content

Instantly share code, notes, and snippets.

@AlexKovax
AlexKovax / fakewebcam.sh
Created January 19, 2014 21:46
This basic shell script uses the raspistill command to take a shot with different settings depending on the time. It's made to be called using a crontab
#!/bin/bash
#fakewebcam script
TIME=$(date +"%H")
DAY='10'
NIGHT='20'
if [ ${TIME} -ge ${DAY} -a ${TIME} -le ${NIGHT} ]; then
#echo "It's day!"
raspistill -q 90 -w 640 -h 480 -t 60 -o /var/www/webcam.jpg
else
@AlexKovax
AlexKovax / crontab
Created December 25, 2013 17:21
This is a crontab that uses a builtin Z-Way server and wget to do some basic home automation
# Edit this file to introduce tasks to be run by cron.
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h dom mon dow command
@AlexKovax
AlexKovax / interfaces
Last active January 1, 2016 06:29
This is a simple conf file to set up the wireless adapter of a Raspberry Pi using Raspbian
#Basic /etc/network/interfaces file to access an encrypted AP
#Replace SSID by the name of the network the RPi must connect too
#Replace PASSWORD by the WPA password of the network
#loopback and ethernet
auto lo
iface lo inet loopback
iface eth0 inet dhcp
#wlan
@AlexKovax
AlexKovax / kkbb-extractor.php
Last active December 18, 2015 01:39
A quick function to extract the name of the contributors from a Kiss Kiss Bank Bank "contributors" page
<?php
//returns an array with the names extracted
function name_extractor($url){
$res=array();
$html = file($url);
foreach($html as $ligne)
if(preg_match("/class\=\"username\"\>(.+)\<\/a\>/",$ligne,$matches))
array_push($res,$matches[1]);
@AlexKovax
AlexKovax / flickr.html
Created April 20, 2013 18:03
This simple example shows you how to get the latest photos of any Flickr ID using an API call...
<!DOCTYPE html>
<html>
<head>
<title>Flickr</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>
//jsonFlickrFeed is the default callback function returned by flickr, let's use it...