Skip to content

Instantly share code, notes, and snippets.

View albertodeste's full-sized avatar

Alberto D'Este albertodeste

View GitHub Profile
@zanculmarktum
zanculmarktum / megafetch.sh
Last active June 2, 2024 05:58
Get download url from mega.nz
#!/bin/bash
# Copyright 2018, 2019, 2020 Azure Zanculmarktum
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
@meskarune
meskarune / speech2text.sh
Created September 18, 2015 17:09
speech to text bash script using google's voice recognition api
#!/bin/bash
#http://blog.oscarliang.net/raspberry-pi-voice-recognition-works-like-siri/
echo “Recording… Press Ctrl+C to Stop.”
arecord -D “plughw:1,0” -q -f cd -t wav | ffmpeg -loglevel panic -y -i – -ar 16000 -acodec flac file.flac > /dev/null 2>&1
echo “Processing…”
wget -q -U “Mozilla/5.0” –post-file file.flac –header “Content-Type: audio/x-flac; rate=16000” -O – “http://www.google.com/speech-api/v1/recognize?lang=en-us&client=chromium” | cut -d” -f12 >stt.txt
echo -n “You Said: ”
@matriphe
matriphe / ssh-telegram.sh
Last active May 7, 2023 15:00
Bash Script to notify via Telegram Bot API when user log in SSH
# save it as /etc/profile.d/ssh-telegram.sh
# use jq to parse JSON from ipinfo.io
# get jq from here http://stedolan.github.io/jq/
USERID="<target_user_id>"
KEY="<bot_private_key>"
TIMEOUT="10"
URL="https://api.telegram.org/bot$KEY/sendMessage"
DATE_EXEC="$(date "+%d %b %Y %H:%M")"
TMPFILE='/tmp/ipinfo-$DATE_EXEC.txt'
if [ -n "$SSH_CLIENT" ]; then
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active June 1, 2024 14:11
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@mdesantis
mdesantis / .Xmodmap
Created November 26, 2011 17:58
Solving swapped keys ( <> key is wapped with \| key ) of the italian Apple Keyboard on Ubuntu (from the thread http://forum.ubuntu-it.org/index.php/topic,383892.msg3872344.html )
! Direttive per mappare correttamente la tastiera Apple italiana su Ubuntu,
! cioè, correggere lo scambio dei tasti maggiore/minore con quello di backslash/pipe
!
! 49: codice del tasto maggiore/minore ( <> ) (situato a destra del tasto L-SHIFT)
! 94: codice del tasto backslash/pipe ( \| ) (collocato a sinistra del tasto `uno/punto esclamativo` ( 1! ) )
!
!
! I comandi scritti sotto, eseguiti da terminale sono:
! xmodmap -e "keycode 49 = less greater guillemotleft guillemotright guillemotleft guillemotright" && \
! xmodmap -e "keycode 94 = backslash bar notsign brokenbar notsign brokenbar"