Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@LucaTNT
LucaTNT / scrapmagnet.py
Last active January 5, 2017 08:49
Edited scrapmagnet.pys to make it work with the node version of scrapmagnet.js on FreeBSD/FreeNAS
###############################################################################
import base64
import common
import platform
import os
import re
import stat
import socket
import subprocess
import time
@LucaTNT
LucaTNT / log-speedtest.sh
Created March 2, 2016 18:50
A script that appends to a CSV file the results of your internet speed test (via speediest-cli)
#!/bin/bash
OUTPUT="`speedtest-cli --simple`"
PING=`echo "$OUTPUT" | grep Ping | sed 's/[a-zA-Z:]* \([0-9]*\.[0-9]*\) [a-zA-Z/]*/\1/'`
DOWNLOAD=`echo "$OUTPUT" | grep Download | sed 's/[a-zA-Z:]* \([0-9]*\.[0-9]*\) [a-zA-Z/]*/\1/'`
UPLOAD=`echo "$OUTPUT" | grep Upload | sed 's/[a-zA-Z:]* \([0-9]*\.[0-9]*\) [a-zA-Z/]*/\1/'`
DATE=`date +%Y/%m/%d`
TIME=`date +%H:%M:%S`

Keybase proof

I hereby claim:

  • I am lucatnt on github.
  • I am lucatnt (https://keybase.io/lucatnt) on keybase.
  • I have a public key ASDr6Win6i4E2mPEt_us1ZyGwWmRwZLjBrQxJ39pBJNEcAo

To claim this, I am signing this object:

@LucaTNT
LucaTNT / ForceFinderRefresh.applescript
Created April 26, 2017 18:36
Script that forces the refresh of the current Finder window
tell application "Finder"
tell front window to update every item
try
delete (make new file at (front window) with properties {name:".refresh.tmp"})
end try
end tell
@LucaTNT
LucaTNT / apritiSesamo.py
Last active July 26, 2017 18:00
Script that triggers a relay connected to GPIO 25 on a Raspberry Pi in order to open a garage door
#!/usr/bin/env python
from gpiozero import LED, Button
from time import sleep
from flask import Flask
import datetime
portone = LED(25)
app = Flask(__name__)
@LucaTNT
LucaTNT / lookForNewiOS.sh
Last active March 28, 2018 17:59
Automatic iOS firmware downloader
#!/bin/bash
# lookForNewiOS.sh
# Author: Luca Zorzi (@LucaTNT)
# Version: 0.2 (2014/11/20)
# License: BSD
# -----------------------------
# This scripts uses icj.me's API to check if there are new iOS releases for
# the iOS devices specified in the MODELS array. You can put any number of devices,
# as long as they are in an array (space separated, enclosed in brackets).
# If a new release is available, it gets download into the DESTINATION_FOLDER, respecting
@LucaTNT
LucaTNT / iTunes-now-playing-on-TouchBar.scpt
Last active September 27, 2018 09:51
his script can be used in conjunction with Better Touch Tool to display the currently playing track in iTunes on the MacBook Pro TouchBar. More info here: https://lucatnt.com/2017/02/display-the-currently-playing-track-in-itunesspotify-on-the-touch-bar
-- This script can be used in conjunction with Better Touch Tool to display the currently playing track on the MacBook Pro TouchBar
-- More info here: https://lucatnt.com/2017/02/display-the-currently-playing-track-in-itunesspotify-on-the-touch-bar
if application "iTunes" is running then
tell application "iTunes"
if player state is playing then
return (get artist of current track) & " - " & (get name of current track)
else
return ""
end if
@LucaTNT
LucaTNT / Spotify-now-playing-on-TouchBar.scpt
Last active September 27, 2018 09:51
This script can be used in conjunction with Better Touch Tool to display the currently playing track in Spotify on the MacBook Pro TouchBar. More info here: https://lucatnt.com/2017/02/display-the-currently-playing-track-in-itunesspotify-on-the-touch-bar
-- This script can be used in conjunction with Better Touch Tool to display the currently playing track on the MacBook Pro TouchBar
-- More info here: https://lucatnt.com/2017/02/display-the-currently-playing-track-in-itunesspotify-on-the-touch-bar
if application "Spotify" is running then
tell application "Spotify"
if player state is playing then
return (get artist of current track) & " - " & (get name of current track)
else
return ""
end if
@LucaTNT
LucaTNT / convertVideo.sh
Created August 1, 2014 11:04
Convert IP camera recordings to lower quality for archiving
#!/bin/bash
# convertVideo.sh
# ---------------
# This script converts the original, high quality recording to a much smaller
# and lower quality file for archiving purposes.
# ---------------
# Author: @LucaTNT
# License: BSD
# Define some paths
@LucaTNT
LucaTNT / recordCam.sh
Last active June 17, 2021 19:56
Record Foscam IP camera live feed
#!/bin/bash
# recordCam.sh
# ------------
# This script saves the live video from the Foscam IP camera to a full-quality mp4 file.
# I chose to split the files every 15 minutes (900 seconds), to quickly find the time I need.
# Note: audio is not saved as my cameras don't have a microphone connected to them.
# -----------
# Author: @LucaTNT
# License: BSD