Skip to content

Instantly share code, notes, and snippets.

View frafra's full-sized avatar

Francesco Frassinelli frafra

View GitHub Profile
@frafra
frafra / united_music_playlist.sh
Created July 10, 2013 14:05
Little project for generating United Music web radios XSPF playlist
#!/bin/bash
#
# Copyright (C) 2013 Francesco Frassinelli (FraFra - http://frafra.eu)
# License: GPLv3
#
# Special thanks to: http://blog.redaelli.eu/2010/03/lista-di-radio-su-unitedradioit.html
filename="unitedradio-it.xspf"
server="http://shoutcast.unitedradio.it"
@frafra
frafra / divide.py
Created October 3, 2013 19:35
Split every PDF page in 2 or 4 parts
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2013 Francesco Frassinelli
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
@frafra
frafra / click_timing.sh
Last active December 26, 2015 06:29
Calculate interval between two clicks
#!/bin/bash
DEV="/dev/input/mouse0"
SEQ="ht nul nul"
function click_event {
stdbuf -oL od -w3 -t a -A n "$DEV" | grep -m1 "$SEQ" > /dev/null
}
click_event
@frafra
frafra / select-default-source.sh
Created November 13, 2013 18:56
Select default source for PulseAudio
#!/bin/bash
# select-default-source.sh
# Description: Select default source for PulseAudio
# Author: FraFra (Francesco Frassinelli - frafra.eu)
# License: GPLv3
SOURCES=($(LC_ALL=C pactl list sources | grep -P '^\tName: ' | cut -d ' ' -f 2))
DEFAULT=$(LC_ALL=C pactl info | grep '^Default Source: ' | cut -d ' ' -f 3)
echo "Sources:"
#!/bin/bash
# organize-your-files.sh
# Description: Organize your files
# Author: FraFra (Francesco Frassinelli - frafra.eu)
# License: GPLv3
#
# Idea presa da:
# http://magliettabianca.blogspot.it/2013/11/bash-guida-allautomazione-organizzare-i.html
#
# Questa versione migliora alcuni aspetti:
@frafra
frafra / bici-in-città.sh
Created November 28, 2013 21:10
Mostra lo stato delle stazioni per le biciclette di Savona
#!/bin/bash
SAVONA='http://www.bicincitta.com/citta_v3.asp?id=43&pag=2'
NAME="bici-in-città"
temp=$(mktemp --suffix=$NAME)
curl -s $SAVONA -o $temp
code=$(grep 'var sita_n' $temp | cut -d\" -f2,4 --output-delimiter=)
IFS=$'_' places=($code)
@frafra
frafra / select-default-sink.sh
Last active December 28, 2016 18:09
Select default sink for PulseAudio
#!/bin/bash
# select-default-subj.sh
# Description: Select default sink for PulseAudio
# Author: FraFra (Francesco Frassinelli - frafra.eu)
# License: GPLv3
SINKS=($(LC_ALL=C pactl list sinks | grep -P '^\tName: ' | cut -d ' ' -f 2))
DEFAULT=$(LC_ALL=C pactl info | grep '^Default Sink: ' | cut -d ' ' -f 3)
echo "Sinks:"
@frafra
frafra / sms-from-bash.sh
Last active January 1, 2016 18:09
Send SMS using USB dongle or smartphone
#!/bin/bash
# sms-from-bash.sh
# Description: Send SMS using USB dongle or smartphone
# Author: FraFra (Francesco Frassinelli - frafra.eu)
# License: GPLv3
MODEM=/dev/ttyACM0
T=3
if [ ! -w $MODEM ]
@frafra
frafra / share-connection.sh
Last active April 13, 2021 13:32
Wifi connection over ethernet (Fedora setup)
export in_dev="eno1"
export out_dev="wlp0s20u7"
nmcli dev set ${in_dev} managed no
cat << EOF > /etc/dnsmasq.conf
# Only listen to routers' LAN NIC. Doing so opens up tcp/udp port 53 to
# localhost and udp port 67 to world:
interface=${in_dev}
# dnsmasq will open tcp/udp port 53 and udp port 67 to world to help with
@frafra
frafra / ydlredirect-bookmarklet.js
Created August 29, 2014 09:04
(youtube-dl) + web service + bookmarklet = play just the video/no Flash
javascript:(function(){window.location='http://localhost:8080?url='+window.btoa(unescape(encodeURIComponent(window.location)));})()