Skip to content

Instantly share code, notes, and snippets.

View juzam's full-sized avatar

Giovanni Angoli juzam

  • Italia
View GitHub Profile
@juzam
juzam / transcode_audio.sh
Created August 19, 2020 10:38
ffmpeg wrapper to transcode audio to aac format (copying video track)
#!/bin/bash
set -x
FULLFILE=$@
EXTENSION=${FULLFILE##*.}
EXTENSIONLESS_FILE=$(basename -s .$EXTENSION $FULLFILE )
ffmpeg -i "$FULLFILE" -f matroska -vcodec copy -acodec aac -ac 2 -strict -2 -map 0 -map -0:s "$EXTENSIONLESS_FILE-converted.mkv"
@juzam
juzam / tp_metrics_to_gc.sh
Created January 3, 2020 15:22
Parse Training Peaks Metrics zipped export file and converts it to Golden Cheetah metrics import CSV format
#!/bin/bash
UNZIP=$( which unzip )
INPUT_FILE=$1
if [ -$INPUT_FILE- == -- ]; then
echo "usage: $0 trainingpeaksexportfile.zip"
exit 1
fi
@juzam
juzam / check_time_machine.sh
Created May 18, 2019 16:10
Nagios/Icinga Apple Time machine check
#!/bin/sh
# based on: https://www.reddit.com/r/macsysadmin/comments/6jvsyx/finding_date_of_last_time_machine_backup_in/djind3p/ and original post
# if mac os >= 10.9 pathPlistNew="/Library/Preferences/com.apple.TimeMachine.plist"
# otherwise it's pathPlistOld="/private/var/db/.TimeMachine.Results.plist
EXIT_OK=0;
EXIT_WARNING=1;
EXIT_CRITICAL=2;
EXIT_UNKNOWN=3;
@juzam
juzam / customlayout.lua
Last active January 4, 2019 14:31
Keybow Custom Layout
require "keybow"
alt = 0 -- used to cycle key 11
function modifier(key, ...)
for i = 1, select('#', ...) do
local j = select(i, ...)
keybow.set_modifier(j, keybow.KEY_DOWN)
end
keybow.tap_key(key)
@juzam
juzam / hare.c
Created March 26, 2018 17:35 — forked from jpmens/hare.c
hare / hared
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <memory.h>
#include <sys/socket.h>
/*
@juzam
juzam / ot-getdata.ps1
Last active February 20, 2022 22:05
Publish Win10 laptop position/battery to an http(s) Owntracks endpoint. a.k.a. poor man's laptop tracking (WSL and jo binary required)
Add-Type -AssemblyName System.Device #Required to access System.Device.Location namespace
[cultureinfo]::currentculture = 'en-US';
$GeoWatcher = New-Object System.Device.Location.GeoCoordinateWatcher #Create the required object
$GeoWatcher.Start() #Begin resolving current locaton
while (($GeoWatcher.Status -ne 'Ready') -and ($GeoWatcher.Permission -ne 'Denied')) {
Start-Sleep -Milliseconds 100 #Wait for discovery.
}
@juzam
juzam / xetex-example-linlibertine.tex
Created January 12, 2018 08:36
xetex ligatures lin libertine otf example
\documentclass[11pt]{article}
\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{Linux Libertine O}
\begin{document}
\section{Unicode support}
\subsection{English}
All human beings are born free and equal in dignity and rights.
\subsection{Íslenska}
@juzam
juzam / fakenews.js
Last active December 1, 2017 09:58
GreaseMonkey/Tampermonkey script to substitute every occurrence of "fake news" with a more accurate description.
// ==UserScript==
// @name Grande Minchiata
// @namespace http://juzam.net/
// @version 0.1
// @description fake news = minchiate
// @author juzam@juzam.net
// @match http://*/*
// @include *
// @grant none
// ==/UserScript==
@juzam
juzam / Dockerfile
Last active August 31, 2017 15:37
ot-recorder .deb build Dockerfiles/scripts
FROM debian:stretch
RUN apt-get update && apt-get install -y build-essential libcurl4-openssl-dev libmosquitto-dev liblua5.2-dev libsodium-dev libconfig-dev
# fpm
RUN apt-get install -y ruby ruby-dev rubygems gcc make
RUN gem install --no-ri --no-rdoc fpm
RUN apt-get install -y vim git && git clone https://github.com/owntracks/recorder.git
@juzam
juzam / wifi_positioning_system.py
Created January 8, 2017 11:56 — forked from initbrain/NOTICE.md
Python Wi-Fi Positioning System, use Google Maps Geolocation API, tested on GNU/Linux (require iw) and Mac OS X (require airport), special thanks go to contributors!
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Julien Deudon (initbrain) - 20/03/2012
# modified to run on OS X by James Armitage - 25/06/2012
# modified to process in python by Dan Gleebits - 26/06/2012
# modified to parse the xml output of airport by Vincent Ohprecio - 01/10/2012
# modified to work with the new Google geolocation API by Giovanni Angoli (juzam) - 03/01/2017
# merging all modifications by Julien Deudon (initbrain) - 06/01/2017
from commands import getoutput, getstatusoutput