(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
#!/bin/bash | |
#Linux Spotify Ad Mute v2 | |
#Put this script in the directory the "spotify" binary is in (e.g. /usr/share/spotify). | |
#To open Spotify, run it instead of the "spotify" binary. | |
#System sound will be muted as soon as an ad plays | |
#Find updated versions at: http://pcworldsoftware.kilu.net/files/link_spotify-admute.php and/or https://gist.github.com/pcworld | |
#On Debian, you need the package "pulseaudio-utils" for the command line util "pactl" which used in this script | |
# | |
#Update: For newer 0.8.x versions (x>4; such as 0.8.8), use this script: https://gist.github.com/pcworld/3198763/#comment-813440 |
// From http://www.nbdtech.com/Blog/archive/2008/04/27/Calculating-the-Perceived-Brightness-of-a-Color.aspx | |
// returns a number in the rage of 0 (black) to 255 (White) and to set the foreground color based on the Brightness method | |
// c is an array where 0 is red, 1 is green, 2 is blue | |
//rgb values are on a 0 - 255 scale | |
var colorBrightness = function(c){ | |
return Math.sqrt( | |
c[0] * c[0] * .241 + | |
c[1] * c[1] * .691 + | |
c[2] * c[2] * .068); |