Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
notify-send --expire-time=10000 --icon=translator "$(xsel -o)" "$(wget -O - "http://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=tr&dt=t&q=$(xsel -o)" | awk -F'"' '{print $2}')"
gtts-cli "$(xsel -o)" | mpg123 -
# /etc/nextdns.conf
#
discovery-dns
auto-activate false
control /run/nextdns/nextdns.sock
config CONFIG_ID
max-ttl 0s
report-client-info true
cache-size 10MB
bogus-priv true
@fpillet
fpillet / scale.js
Created May 26, 2011 12:07
Javascript value scaling between two ranges
/* Scale a value from one range to another
* Example of use:
*
* // Convert 33 from a 0-100 range to a 0-65535 range
* var n = scaleValue(33, [0,100], [0,65535]);
*
* // Ranges don't have to be positive
* var n = scaleValue(0, [-50,+50], [0,65535]);
*
* Ranges are defined as arrays of two values, inclusive