Skip to content

Instantly share code, notes, and snippets.

@whobutsb
whobutsb / gist:07383d6e464f61749ee1
Last active August 29, 2015 14:13
Keybase.io Proof
### Keybase proof
I hereby claim:
* I am whobutsb on github.
* I am stevebarbera (https://keybase.io/stevebarbera) on keybase.
* I have a public key whose fingerprint is 7F73 AC83 F5D1 BBE1 DFB8 8388 608F 6408 ADD7 2D74
To claim this, I am signing this object:
@whobutsb
whobutsb / github_repo.sh
Created April 18, 2017 17:51
Open GitHub repo in bash
function Github() {
if [ ! -d .git ] ;
then echo "ERROR: This isn't a git directory" && return false;
fi
git_url=`git config --get remote.origin.url`
if [[ $git_url != git@github.com:* ]] ;
then echo "ERROR: Remote origin is invalid" && return false;
fi
url=${git_url%.git}
if [[ $url == git@github.com:* ]] ;
const Ffmpeg = require(‘fluent-ffmpeg’);
const STREAM_URL = ‘http://icecast.radio24.ch/radio24-rc-96-aac';
const VOLUME_THRESHOLD = -50; // volume threshold
getMeanVolume(STREAM_URL, function(meanVolume){
if(meanVolume <= VOLUME_THRESHOLD){
console.log(“WE HAVE A PROBLEM! VOLUME IS TOO LOW!”);
}else{
console.log(‘ALL GOOD!’);
}
@whobutsb
whobutsb / soundcloud-playpause.applescript
Created June 7, 2018 02:42
AppleScript to Play and Pause SoundCloud
on alfred_script(q)
tell application "Google Chrome"
set allWins to every window
set allTabs to {}
repeat with currWin in allWins
set allTabs to allTabs & every tab of currWin
end repeat
repeat with currTab in allTabs
try
if (URL of currTab) starts with "https://soundcloud.com" or "http://soundcloud.com" then set musicTab to currTab
chrome = Application("Google Chrome");
windows = chrome.windows;
for(i = 0; i < windows.length; i++){
tabs = windows[i].tabs;
for(j = 0; j < tabs.length; j++){
url = tabs[j].url();
if(url.match(/soundcloud.com/)){
tabs[j].execute({ javascript: "document.querySelector('.playControl').click();" });
chrome = Application("Google Chrome");
windows = chrome.windows;
for(i = 0; i < windows.length; i++){
tabs = windows[i].tabs;
for(j = 0; j < tabs.length; j++){
url = tabs[j].url();
if(url.match(/youtube.com/)){
tabs[j].execute({ javascript: "document.querySelector('.ytp-play-button').click();" });
@whobutsb
whobutsb / chrome-tabs.js
Created October 19, 2018 15:18
Opening Chrome Tabs in JXA
// grab the chrome object
var chrome = Application('Google Chrome');
// create a new chrome window
var window = chrome.Window().make();
// set the links you want to open
var links = [
"https://gmail.com",
"https://soundcloud.com",
@whobutsb
whobutsb / playpause-soundcloud.js
Created October 19, 2018 15:29
Play and Pause SoundCloud with JXA
// grab the chrome object
var chrome = Application("Google Chrome");
// grab all of the chrome windows
var windows = chrome.windows;
// loop through the chrome windows
for(i = 0; i < windows.length; i++){
// grab all of the tabs for the window
@whobutsb
whobutsb / playpause-youtube.js
Created October 19, 2018 15:35
Play and Pause YouTube from JXA
var chrome = Application("Google Chrome");
var windows = chrome.windows;
for(i = 0; i < windows.length; i++){
var tabs = windows[i].tabs;
for(j = 0; j < tabs.length; j++){
var url = tabs[j].url();
if(url.match(/youtube.com/)){
tabs[j].execute({ javascript: "document.querySelector('.ytp-play-button').click();" });
@whobutsb
whobutsb / osascript
Created November 21, 2019 22:08
Play/Pause SoundCloud
chrome = Application("Google Chrome");
windows = chrome.windows;
for(i = 0; i < windows.length; i++){
tabs = windows[i].tabs;
for(j = 0; j < tabs.length; j++){
url = tabs[j].url();
if(url.match(/soundcloud.com/)){
tabs[j].execute({ javascript: "document.querySelector('.playControl').click();" });