Skip to content

Instantly share code, notes, and snippets.

jordan314

  • Ayzenberg
  • Los Angeles
Block or report user

Report or block jordan314

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jordan314
jordan314 / copySoundcloudPlaylist.js
Created Dec 10, 2019
Copy Soundcloud Playlist to JSON
View copySoundcloudPlaylist.js
//Copies the Artist, Track and URL of a playlist to the clipboard in JSON format
//Run in console on a soundcloud page with a playlist:
copy([...document.querySelectorAll('.trackItem__content')].map(ele => {return ({'artist' : ele.querySelectorAll('a')[0].innerHTML, 'track' : ele.querySelectorAll('a')[1].innerHTML, 'url' : ele.querySelectorAll('a')[1].href})}))
//or log it:
[...document.querySelectorAll('.trackItem__content')].map(ele => {return ({'artist' : ele.querySelectorAll('a')[0].innerHTML, 'track' : ele.querySelectorAll('a')[1].innerHTML, 'url' : ele.querySelectorAll('a')[1].href})})
//Example output of my 2019 playlist:
/*
[
{
"artist": "JUST A GENT",
@jordan314
jordan314 / youtube-dl-mp4
Created Dec 5, 2019
youtube-dl-mp4 for forcing youtube-dl to download mp4
View youtube-dl-mp4
#!/bin/bash
#for OS X or linux
#place this file in /usr/local/bin/youtube-dl-mp4
#and chmod +x /usr/local/bin/youtube-dl-mp4
youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4' $1
@jordan314
jordan314 / testheadphones.sh
Created Mar 21, 2019
Test if headphones are plugged in -- OS X shell script
View testheadphones.sh
#!/bin/bash
if system_profiler SPAudioDataType | grep --quiet Headphones; then
echo plugged in
else
echo not plugged in
fi
View autoscrollwebsite.js
//Paste this in console (in another window) to auto-scroll a website, useful for video capturing.
var i = 0;setInterval(function(){window.scrollTo(0, i);i = i+ 2;}, 5);
@jordan314
jordan314 / robotArmServer.ino
Created Feb 25, 2018
Arduino script for listening for bridge commands and controlling a robot arm
View robotArmServer.ino
/*
Arduino Yún Bridge example
This example for the YunShield/Yún shows how
to use the Bridge library to access the digital and
analog pins on the board through REST calls.
It demonstrates how you can create your own API when
using REST style calls through the browser.
Possible commands created in this shetch:
@jordan314
jordan314 / armproxy.js
Created Feb 25, 2018
Node Proxy to forward commands to Yun
View armproxy.js
//replace {myport} with any port number and {mytoken} with any URL-friendly string.
var request = require('request');
const express = require('express')
const app = express()
app.get('/', (req, res) => {
if(req.query.token != '{mytoken}')
{
res.send('Invalid Token');
return;
@jordan314
jordan314 / robotarmlamda.py
Last active Feb 25, 2018
Robot Arm Lamda that hits another node endpoint
View robotarmlamda.py
# -*- coding: utf-8 -*-
# Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Amazon Software License (the "License"). You may not use this file except in
# compliance with the License. A copy of the License is located at
#
# http://aws.amazon.com/asl/
#
# or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS,
@jordan314
jordan314 / getlatestwiredarticle.js
Last active Feb 24, 2018
Get latest wired article
View getlatestwiredarticle.js
//Run in console on a page with jQuery. (Most web pages)
jQuery.getJSON('https://www.wired.com/wp-json/wp/v2/posts/', function(response){console.log(response[0].title, response[0].content);})
//Here's a version that doesn't need jQuery:
xhr = new XMLHttpRequest;
xhr.onreadystatechange = function() {
if (xhr.readyState == 4 && xhr.status == 200) {
response = JSON.parse(xhr.responseText);
console.log(response[0].title, response[0].content);
@jordan314
jordan314 / Google Sheets Formula for Address Formatting
Created Jan 13, 2018
Google Sheets/Excel Formula for formatting addresses
View Google Sheets Formula for Address Formatting
For cells:
C3: First Name 1
D3: Last Name 1
E3: First Name 2
F3: Last Name 2
H3: Mailing Address 1
I3: Mailing Address 2 (Optional)
J3: City
K3: State
(L3: Country unused)
@jordan314
jordan314 / commandlineinteractive.php
Created Nov 28, 2017
Use PHP to interact with stdin
View commandlineinteractive.php
while(true):
echo "Are you sure you want to do this? Type 'yes' to continue: ";
$handle = fopen ("php://stdin","r");
$line = fgets($handle);
if(trim($line) == 'yes'){
break;
}
endwhile;
fclose($handle);
echo "\n";
You can’t perform that action at this time.