This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"> | |
<style> | |
body { | |
margin: 0px; | |
overflow: hidden; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* euclidean GCD (feel free to use any other) */ | |
function gcd(a,b) {if(b>a) {temp = a; a = b; b = temp} while(b!=0) {m=a%b; a=b; b=m;} return a;} | |
/* ratio is to get the gcd and divide each component by the gcd, then return a string with the typical colon-separated value */ | |
function ratio(x,y) {c=gcd(x,y); return ""+(x/c)+":"+(y/c)} | |
/* eg: | |
> ratio(320,240) | |
"4:3" | |
> ratio(360,240) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Recursive approach | |
* Time complexity - O(2^n) | |
* Space complexity - O(n), take into account additional stack memory and memory for subsets | |
* https://github.com/olehch/subsetsum | |
*/ | |
const arr = [17, 2, 8, 34, 4, 0.5, 42, 6, 3, 7, 15, 14, 9] | |
const sum = 20 | |
let result = null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To list any process listening to the port 8080: | |
lsof -i:8080 | |
To kill any process listening to the port 8080: | |
kill $(lsof -t -i:8080) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set mylist to {"Beats", "Brasil", "Dubstep/Grime", "Groove", "Jungle/DNB/Electronic", "Rap", "Reggae/Dub", "Trap", "Trip-Hop"} | |
set loc to choose folder "Choose Parent Folder Location" | |
tell application "iTunes" | |
set myPlaylists to every playlist | |
repeat with myPlaylist in myPlaylists | |
if mylist contains name of myPlaylist then | |
set playListName to name of myPlaylist | |
set myTracks to every track of myPlaylist |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function base64ToBlob(data) { | |
var byteString = atob(data.split(',')[1]); | |
var mimeString = data.split(',')[0].split(':')[1].split(';')[0] | |
var ab = new ArrayBuffer(byteString.length); | |
var ia = new Uint8Array(ab); | |
for (var i = 0; i < byteString.length; i++) { | |
ia[i] = byteString.charCodeAt(i); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
files.txt >>> | |
file '01.mp3' | |
file '02.mp3' | |
file '03.mp3' | |
file '04.mp3' | |
file '05.mp3' | |
file '06.mp3' | |
file '07.mp3' | |