From 784563309ea7284e41016f3ae2039877b4b8b7cd Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Thu, 24 Oct 2024 01:43:24 -0400 Subject: [PATCH] Added Google Foobar and DOJC Songs --- .gitignore | 1 + DOJC Songs/.htaccess | 10 + DOJC Songs/api.floofy.php | 80 +++++ DOJC Songs/api.php | 80 +++++ DOJC Songs/desktop/desktop.css | 455 ++++++++++++++++++++++++ DOJC Songs/desktop/desktop.html | 73 ++++ DOJC Songs/desktop/desktop.js | 556 +++++++++++++++++++++++++++++ DOJC Songs/desktop/visualizer.js | 123 +++++++ DOJC Songs/header.html | 43 +++ DOJC Songs/logo.png | Bin 0 -> 87907 bytes DOJC Songs/mobile/mobile.css | 263 ++++++++++++++ DOJC Songs/mobile/mobile.html | 38 ++ DOJC Songs/mobile/mobile.js | 559 ++++++++++++++++++++++++++++++ Google FooBar/boomBaby.py | 24 ++ Google FooBar/bunnyMessage.py | 48 +++ Google FooBar/disorderlyEscape.py | 90 +++++ Google FooBar/dodgeTheLasers.py | 27 ++ Google FooBar/doomsdayFuel.py | 70 ++++ Google FooBar/elevatorVersion.py | 14 + Google FooBar/expandingNebula.py | 81 +++++ Google FooBar/freeBunnies.py | 10 + Google FooBar/gunFight.py | 108 ++++++ Google FooBar/luckyTriple.py | 10 + Google FooBar/primeGen.py | 24 ++ Google FooBar/primes.txt | 167 +++++++++ Google FooBar/reid.py | 170 +++++++++ Google FooBar/setCounting.txt | 22 ++ 27 files changed, 3146 insertions(+) create mode 100644 .gitignore create mode 100644 DOJC Songs/.htaccess create mode 100644 DOJC Songs/api.floofy.php create mode 100644 DOJC Songs/api.php create mode 100644 DOJC Songs/desktop/desktop.css create mode 100644 DOJC Songs/desktop/desktop.html create mode 100644 DOJC Songs/desktop/desktop.js create mode 100644 DOJC Songs/desktop/visualizer.js create mode 100644 DOJC Songs/header.html create mode 100644 DOJC Songs/logo.png create mode 100644 DOJC Songs/mobile/mobile.css create mode 100644 DOJC Songs/mobile/mobile.html create mode 100644 DOJC Songs/mobile/mobile.js create mode 100644 Google FooBar/boomBaby.py create mode 100644 Google FooBar/bunnyMessage.py create mode 100644 Google FooBar/disorderlyEscape.py create mode 100644 Google FooBar/dodgeTheLasers.py create mode 100644 Google FooBar/doomsdayFuel.py create mode 100644 Google FooBar/elevatorVersion.py create mode 100644 Google FooBar/expandingNebula.py create mode 100644 Google FooBar/freeBunnies.py create mode 100644 Google FooBar/gunFight.py create mode 100644 Google FooBar/luckyTriple.py create mode 100644 Google FooBar/primeGen.py create mode 100644 Google FooBar/primes.txt create mode 100644 Google FooBar/reid.py create mode 100644 Google FooBar/setCounting.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c18dd8d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +__pycache__/ diff --git a/DOJC Songs/.htaccess b/DOJC Songs/.htaccess new file mode 100644 index 0000000..039e93f --- /dev/null +++ b/DOJC Songs/.htaccess @@ -0,0 +1,10 @@ +Options +Indexes +IndexOptions IgnoreCase FancyIndexing FoldersFirst NameWidth=* DescriptionWidth=* SuppressHTMLPreamble +RewriteEngine On + + Header set Access-Control-Allow-Origin "*" + + # SPECIFY HEADER FILE + HeaderName /header.html + # IGNORE THESE FILES + IndexIgnore /header.html /api.php \ No newline at end of file diff --git a/DOJC Songs/api.floofy.php b/DOJC Songs/api.floofy.php new file mode 100644 index 0000000..2517739 --- /dev/null +++ b/DOJC Songs/api.floofy.php @@ -0,0 +1,80 @@ +$cur) { + $filesize=$cur->getSize(); + $bytestotal+=$filesize; + $nbfiles++; + $files[] = $filename; + } + + $bytestotal=number_format($bytestotal); + + return array('total'=>$nbfiles,'size'=>$bytestotal,'files'=>$files); +} + +$files = scan_dir('/home/discordo/public_html/subdomain/music_dir/'); +$subtract = 0; +for($mp3 = 0; $mp3 <= 100; $mp3++) { + if (strpos($files['files'][$mp3], '.mp3') == false) { + if (isset($files['files'][$mp3])) { + unset($files['files'][$mp3]); + $subtract++; + }; + }; +}; +$files['total'] = $files['total'] - $subtract; + +$json = json_encode($files); +printf($json);*/ \ No newline at end of file diff --git a/DOJC Songs/api.php b/DOJC Songs/api.php new file mode 100644 index 0000000..84ef5ec --- /dev/null +++ b/DOJC Songs/api.php @@ -0,0 +1,80 @@ +$cur) { + $filesize=$cur->getSize(); + $bytestotal+=$filesize; + $nbfiles++; + $files[] = $filename; + } + + $bytestotal=number_format($bytestotal); + + return array('total'=>$nbfiles,'size'=>$bytestotal,'files'=>$files); +} + +$files = scan_dir('/home/discordo/public_html/subdomain/music_dir/Database'); +$subtract = 0; +for($mp3 = 0; $mp3 <= 100; $mp3++) { + if (strpos($files['files'][$mp3], '.mp3') == false) { + if (isset($files['files'][$mp3])) { + unset($files['files'][$mp3]); + $subtract++; + }; + }; +}; +$files['total'] = $files['total'] - $subtract; + +$json = json_encode($files); +printf($json); \ No newline at end of file diff --git a/DOJC Songs/desktop/desktop.css b/DOJC Songs/desktop/desktop.css new file mode 100644 index 0000000..c762f86 --- /dev/null +++ b/DOJC Songs/desktop/desktop.css @@ -0,0 +1,455 @@ +html { + height: 100%; + width: 100%; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +pre { + display: none !important; +} + +body { + display: grid; + height: 100%; + overflow: hidden; + padding: 0; + margin: 0; + color: white; + font-family: 'Open Sans Condensed', sans-serif; + grid-template-columns: 15% auto; + grid-template-rows: 8% auto; +} + +h1, h2, h3, h4, h5, p { + margin: 0; +} + +a { + text-decoration: none; + color: #2EA8FF; +} + +.transition { + -webkit-transition: all 0.3s cubic-bezier(.25, .8, .25, 1); + transition: all 0.3s cubic-bezier(.25, .8, .25, 1); + -moz-transition: all 0.3s cubic-bezier(.25, .8, .25, 1); + -ms-transition: all 0.3s cubic-bezier(.25, .8, .25, 1); +} + +#header1 { + display: grid; + background-color: #292828; + text-align: center; + grid-column: 1; + grid-row: 1; + cursor: pointer; +} + +#header1 img { + margin: auto; + height: 80%; +} + +#header2 { + display: grid; + grid-template-columns: repeat(5, 1fr); + background-color: #151313; + grid-column: 2; + grid-row: 1; +} + +#header2 div { + margin: auto; + font-size: 150%; +} + +#header2 p { + cursor: pointer; + border-radius: 5px; + padding: 5%; + width: 100%; +} + +#header2 p:hover { + background-color: rgba(255,255,255,0.1); +} + +#header2 i { + margin-left: 2%; +} + +#spectrum { + grid-column: 5; + grid-row: 1; +} + +#sidebar { + position: relative; + background-color: #151313; + grid-column: 1; + grid-row: 2; +} + +#sidebar span { + font-size: 110%; + padding: 5%; + position: absolute; + bottom: 0; +} + +#sidebar span p { + cursor: pointer; + color: #63d4ff; + display: inline; +} + +.navi { + display: grid; + height: 6vh; + width: 100%; + cursor: pointer; + grid-template-columns: 1fr 3fr 7fr; +} + +.naviInner { + background-color: rgba(0,0,0,0.15); +} + +.naviInner div { + display: grid; + height: 4vh; + width: 100%; + cursor: pointer; + grid-template-columns: 3fr 7fr; +} + +.navi:hover, .naviInner div:hover { + background-color: rgba(255, 255, 255, 0.1) !important +} + +.navi i { + margin: auto 0 auto 0; + font-size: 2.1vh; + text-align: center; + grid-column: 2; +} + +.navi p { + margin: auto 0 auto 0; + font-size: 2vh; + grid-column: 3; +} + +.naviInner p { + margin: auto 0 auto 0; + font-size: 2vh; + grid-column: 2; +} + +#mainContainer { + overflow: hidden; + background-color: #070606; + font-family: 'Saira Condensed', sans-serif; + grid-column: 2; + grid-row: 2; +} + +.card { + display: grid; + border-radius: 2px; + background-color: #FEFEFE; + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24); + color: black; + transition: all 0.3s cubic-bezier(.25, .8, .25, 1); + grid-template-columns: 35% auto 25% 15%; + grid-template-rows: 6vh auto; +} + +.card:hover { + box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23); +} + +#songList { + height: 100%; + color: white; + display: grid; + grid-template-columns: 100%; + grid-template-rows: 90% 10%; +} + +#directory { + display: grid; + grid-column: 1; + grid-row: 1; + grid-template-columns: 100%; + grid-template-rows: 1fr 2fr 20fr 5fr; +} + +#directory p { + font-size: 150%; + padding: 1.5vh 2vh 1.5vh 2vh; +} + +canvas { + display: none; + grid-column: 1; + grid-row: 4; +} + +#playback { + grid-column: 1; + grid-row: 2; +} + +#directoryHeader { + display: grid; + grid-template-columns: 6fr 2fr 1fr; + grid-template-rows: 100%; + color: black; + background-color: white; + box-shadow: #6f6f6f 0 0 20px 0px; +} + +#directoryHeader p { + display: grid; + cursor: pointer; + grid-template-columns: 19fr 1fr; + grid-template-rows: 100%; + padding: 2.3vh; +} + +#directoryHeader p:hover { + background-color: rgba(0,0,0,0.1); +} + +#directoryHeader i { + margin: auto; + display: none; + opacity: 0; +} + +#directoryCont { + overflow-y: auto; +} + +.item { + display: grid; + cursor: pointer; + border-bottom: 1px solid white; + background-color: rgba(255,255,255,0.03); + grid-template-columns: 6fr 2fr 1fr; + grid-template-rows: 100%; +} + +.item:hover { + background-color: rgba(255,255,255,0.1); +} + +.item p { + pointer-events: none; +} + +#directoryLocation { + opacity: 0; +} + +#directoryLocation p { + padding: 0.5vh; + margin: 1vh 1.5vh 1vh 1.5vh; + border-radius: 5px; + display: inline-block; +} + +#directoryLocation i { + font-size: 150%; +} + +.subdir:hover { + background-color: rgba(255,255,255, 0.1); +} + +#playback { + display: grid; + grid-template-columns: 30% 40% 15% 15%; + grid-template-rows: 100%; + background-color: rgba(255,255,255,0.1); +} + +audio { + display: none; +} + +#playback div { + display: grid; +} + +#playback h2 { + font-size: 2.3vh; + margin: auto 5% auto; + font-weight: 100; +} + +#playback i { + font-size: 2.3vh; +} + +#info { + grid-template-columns: 9fr 1fr; + grid-template-rows: 100%; +} + +#info div { + display: grid; +} + +#info a { + cursor: pointer; + margin: auto; +} + +#info i { + color: rgba(255,255,255,1); +} + +#info i:hover { + color: rgba(255,255,255,0.7); +} + +#tracker { + grid-template-columns: 100%; + grid-template-rows: 1fr 1fr; +} + +#tracker div:first-child { + margin: auto; + display: block; + width: 100%; + text-align: center; +} + +#tracker i { + margin: auto; + cursor: pointer; + padding: 0 3% 0 3%; + +} + +#tracker i:hover { + color: rgba(255,255,255,0.7); +} + +#bar { + display: grid; + grid-template-columns: 10% 80% 10%; + grid-template-rows: 100%; +} + +#bar p { + padding: 0 0 0 10%; + margin: auto 0 auto 0; +} + +#bar p:first-child { + padding: 0 10% 0 0; + margin: auto 0 auto 0; + text-align: right; +} + +#speed, #volume { + grid-template-columns: 20% 80%; + grid-template-rows: 100%; + padding: 10%; +} + +#speed i, #volume i { + margin: auto; + cursor: pointer; +} + +#speed i:hover, #volume i:hover { + color: rgba(255,255,255,0.6); +} + +input[type=range] { + -webkit-appearance: none; + width: 100%; + margin: 3px 0; + background: rgba(0,0,0,0); +} + +input[type=range]:focus { + outline: none; +} + +input[type=range]::-webkit-slider-runnable-track { + width: 100%; + height: 5px; + cursor: pointer; + background: #63d4ff; +} + +input[type=range]::-webkit-slider-thumb { + height: 13px; + width: 13px; + border-radius: 50px; + background-color: white; + cursor: pointer; + -webkit-appearance: none; + margin-top: -3px; +} + +input[type=range]::-moz-range-track { + width: 100%; + height: 5px; + cursor: pointer; + background: #63d4ff; +} + +input[type=range]::-moz-range-thumb { + height: 13px; + width: 13px; + border-radius: 50px; + background: #ffffff; + cursor: pointer; +} + +input[type=range]::-ms-track { + width: 100%; + height: 5px; + cursor: pointer; + background: transparent; + border-color: transparent; + color: transparent; +} + +input[type=range]::-ms-fill-lower { + background: #395373; + border-radius: 50px; +} + +input[type=range]::-ms-fill-upper { + background: #486992; + border-radius: 50px; +} + +input[type=range]::-ms-thumb { + height: 13px; + width: 13px; + border-radius: 50px; + background: #ffffff; + cursor: pointer; + height: 7px; +} + +input[type=range]:focus::-ms-fill-lower { + background: #486992; +} + +input[type=range]:focus::-ms-fill-upper { + background: #5a7fae; +} diff --git a/DOJC Songs/desktop/desktop.html b/DOJC Songs/desktop/desktop.html new file mode 100644 index 0000000..19b3dcc --- /dev/null +++ b/DOJC Songs/desktop/desktop.html @@ -0,0 +1,73 @@ + +
+ +
+
+
+

Spectrum

+
+
+ +
+
+
+
+

DOJC Mixtapes

+
+
+

Name + + +

+

Date Modified + + +

+

Size + + +

+
+
+ +
+ +
+
+
+
+

+
+
+ +
+
+
+
+ + + +
+
+

-:--

+ +

-:--

+
+
+
+ + +
+
+ + +
+ +
+
+
+ \ No newline at end of file diff --git a/DOJC Songs/desktop/desktop.js b/DOJC Songs/desktop/desktop.js new file mode 100644 index 0000000..9084853 --- /dev/null +++ b/DOJC Songs/desktop/desktop.js @@ -0,0 +1,556 @@ +var data, // Stores data from PHP. + vis, + section = 0, + clickable = true, + selectName, // Stores name of folder in selected div + selectDiv, // Stores actual selected div. + currDir = "", + spectrum = false; // Stores enable spectrum option. + +var sort = { + "name": 1, + "date": 1, + "size": 1, +}; +var audioSettings = { + speed: 1, + volume: 1, + mute: false +}; + +var themeColors = { // For reference and for quick changing if need-be. + "main": "#070606", + "sidebar": "#151313", + "highlight": "#63d4ff" +}; + +var navSelect = "songList"; // In the future, this can be dynamically updated, but for demonstration purposes, this is set. +var subNavSelect = ""; + +var navi = [ // Necessary arguments: id, alias, fa | Optional arguments: subnav. + { + "id": "home", + "alias": "Home", + "fa": "home" + }, + { + "id": "forums", + "alias": "Forums", + "fa": "file" + }, + { + "id": "memberList", + "alias": "Member List", + "fa": "users" + }, + { + "id": "calendar", + "alias": "Calendar", + "fa": "calendar" + }, + { + "id": "help", + "alias": "Help", + "fa": "info-circle" + }, + { + "id": "songList", + "alias": "Song List", + "fa": "music" + } +]; + +function getData() { + $.when($.ajax({ + type : 'POST', + url: 'api.floofy.php', + data: {rootdir: 'rootdir'} + })).done(function(d) { + rootDir = d; + checkHash(); + }); +} + +function listDir(dir, sec) { // Directory is the sub-directory, sec is the section of data, if files need to be split up into sections. + var real = rootDir+dir; + $.when($.ajax({ + type : 'POST', + url: 'api.floofy.php', + data: {getdir : [real, sec]}, + })).done(function(d) { + data = d; + if(data[0] === null) { + currDir = ""; + listDir(currDir, 0); + return; + } + if(sec == 0) { + data[0].splice(0,2); + data[1].splice(0,3); + data[2].splice(0,3); + data[3].splice(0,3); + } else { + data[1].splice(0,1); + data[2].splice(0,1); + data[3].splice(0,1); + } + var toObj = []; + for(var i = 0; i < data[0].length; i++) { + toObj.push({ + name: data[0][i], + folder: data[1][i], + date: data[2][i], + size: data[3][i] + }); + } + data = toObj; + sortFiles("name", -1); + clickable = true; + }); +} + +function stringToDate(str) { + var dt; + dt = str.replace(",","").split(" "); + dt = Date.parse(dt[1] + " " + dt[0] + " " + dt[2]); + return dt; +} + +function sortFiles(type, direction) { + switch(type) { + case "name": + data.sort(function(a, b){ return (a.name < b.name) ? direction*1 : direction*-1;}); + break; + case "date": + data.sort(function(a, b){ + a = stringToDate(a.date); + b = stringToDate(b.date); + + return (a < b) ? direction*1 : direction*-1; + }); + break; + case "size": + data.sort(function(a, b){ return (a.size.replace("B","").substring(0, a.size.length-1) < b.size.replace("B","").substring(0, b.size.length-1)) ? direction*1 : direction*-1;}); + } + var ico = document.querySelectorAll("#directoryHeader i"); + for(var i = 0; i < ico.length; i++) { + ico[i].style.opacity = "0"; + } + setTimeout(function() { + for(var i = 0; i < ico.length; i++) { + ico[i].style.display = "none"; + } + var arrow = document.querySelectorAll("#directoryHeader ."+type+" i.fa-chevron-" + ((direction < 0) ? "up" : "down"))[0]; + arrow.style.display = "block" + setTimeout(function() { + arrow.style.opacity = "1"; + }, 1); + }, 300); + try { + clearTbl(); + setTimeout(function() { + document.getElementById("directory").removeChild(document.getElementById("directoryCont")); + dispDir(); + }, 300); + } catch(err) { + dispDir(); + } + +} + +function dispDir() { + updateLocation(); + try { + document.getElementById("directory").removeChild(document.getElementById("directoryCont")); + } catch(err) {} + var cont = document.createElement("div"); + cont.id = "directoryCont"; + cont.style.opacity = "0"; + cont.className = "transition"; + + selectName = ""; + var item; + if(data.length === 0) { + var p = document.createElement("p"); + p.appendChild(document.createTextNode("Nothing here!")); + p.style.fontWeight = "100"; + cont.appendChild(p); + } + for(var i = 0; i < data.length; i++) { + item = createRow(); + + var curr = data[i]; + var name = document.createTextNode(curr.name); + var modified = document.createTextNode(curr.date); + var size = document.createTextNode(curr.size); + + item.childNodes[0].appendChild(name); + if((new Date() - stringToDate(curr.date)) < 604800000) item.childNodes[0].style.color = "#63d4ff"; + item.childNodes[1].appendChild(modified); + item.childNodes[2].appendChild(size); + + var ext = document.createAttribute("ext"); + + if(curr.folder == "true") { + ext.value = "fol"; + } else { + ext.value = curr.name.substring(curr.name.lastIndexOf(".")+1,curr.name.length).toLowerCase(); + } + item.setAttributeNode(ext); + + item.onclick = function() { + if(clickable == true) { + var name = this.childNodes[0].innerText; + url = getURI(name); + if(selectName == name) { + clickable = false; + attr = this.getAttribute("ext"); + if(attr == "fol") { + clearTbl(); + setTimeout(function() { + currDir += name+"/"; + listDir(currDir,0); + }, 300) + return; + } else { + playFile(url, name); + clickable = true; + } + } + selectName = name; + selectDiv = this; + for(var i =0; i < document.getElementsByClassName("item").length;i++){ + document.getElementsByClassName("item")[i].style.backgroundColor = ""; + } + this.style.backgroundColor = "rgba(255,255,255,0.2)"; + } + } + cont.appendChild(item); + item = null; + } + document.getElementById("directory").appendChild(cont); + setTimeout(function() { + document.getElementById("directoryCont").style.opacity = "1"; + }, 100); +} + +function clearTbl() { + selected = undefined; + selectDiv = undefined; + document.getElementById("directoryCont").style.opacity = "0"; + document.getElementById("directoryLocation").style.opacity = "0"; +} + +function createRow() { + var item = document.createElement("div"); + item.className = "item transition"; + var name = document.createElement("p"); + name.className = "name"; + item.appendChild(name); + var modified = document.createElement("p"); + modified.className = "modified"; + item.appendChild(modified); + var size = document.createElement("p"); + size.className = "size"; + item.appendChild(size); + return item; +} + +function updateLocation() { + window.location.hash = currDir.replace(/[\/]+/g,"*").replace(/ /g, "_"); + var loc = document.getElementById("directoryLocation"); + while(loc.firstChild) loc.removeChild(loc.firstChild); + loc.style.opacity = "1"; + var subdir = currDir.split("/"); + subdir = subdir.slice(0, subdir.length-1); + for(var i = 0; i < subdir.length+1; i++) { + var p = document.createElement("p"); + var ic = document.createElement("i"); + ic.className = "fa fa-angle-right"; + if(i !== 0) loc.appendChild(ic); + if(i === 0) { + p.appendChild(document.createTextNode("DOJC Mixtapes")); + } else { + p.appendChild(document.createTextNode(subdir[i-1])); + } + if(i !== subdir.length) { + p.style.cursor = "pointer"; + p.className = "subdir transition"; + p.onclick = function() { + clickable = false; + clearTbl(); + subdirNum = subdir.indexOf(this.innerText); + if(subdirNum === -1) { + currDir = ""; + } else { + currDir = subdir.slice(0, subdirNum+1).reduce(function(a,b) { return a+"/"+b; })+"/"; + } + listDir(currDir, 0); + } + } + loc.appendChild(p); + } +} + +function getURI(name) { + var dirs = (rootDir+currDir+name).split("/"); + var uri = window.location.origin; + for(var i = 1; i < dirs.length; i++) uri+="/"+encodeURIComponent(dirs[i]); + return uri; +} + +function createNav() { + for (var i = 0; i < navi.length; i++) { // Create navigation tabs. + var side = document.getElementById("sidebar"); + var div = document.createElement("div"); + div.className = "navi transition"; + div.setAttribute("option", navi[i].id); + div.onclick = function() { + var op = this.getAttribute("option"); + if (navSelect === op) return; + updateMain(op); + }; + var ic = document.createElement("i"); + ic.className = "fa fa-" + navi[i].fa; + ic["aria-hidden"] = true; + var p = document.createElement("p"); + p.appendChild(document.createTextNode(navi[i].alias)); + div.appendChild(ic); + div.appendChild(p); + side.appendChild(div); + var subNav = navi[i].subNav; + if(!subNav) continue; + + var subNavCont = document.createElement("div"); + subNavCont.className = "naviInner"; + subNavCont.setAttribute("option", navi[i].id); + for(var j = 0; j < subNav.length; j++) { + var eachSubNav = document.createElement("div"); + eachSubNav.className = "transition"; + eachSubNav.setAttribute("option", navi[i].id+"&"+subNav[j].id); + eachSubNav.onclick = function() { + var op = this.getAttribute("option"); + if(subNavSelect === op) return; + updateMain(op); + } + var p2 = document.createElement("p"); + p2.appendChild(document.createTextNode(subNav[j].alias)); + eachSubNav.appendChild(p2); + subNavCont.appendChild(eachSubNav); + } + side.appendChild(subNavCont); + } +} + +function updateNav(op) { // Updates the sidebar navigation (if naviagation tabs are ever dynamically implemented). + var oldNav = document.querySelectorAll("[option=" + navSelect + "]")[0]; + var newNav = document.querySelectorAll("[option=" + op + "]")[0]; + oldNav.style.backgroundColor = "rgba(0,0,0,0)"; + oldNav.style.color = "white"; + newNav.style.backgroundColor = themeColors.main; + newNav.style.color = themeColors.highlight; +} + +function updateMain(op) { // Updates the actual page. + updateNav(op); + switch(op) { + case "home": + window.location = "http://discordonlinejammingcentral.com/"; + break; + case "forums": + window.location = "http://discordonlinejammingcentral.com/"; + break; + case "memberList": + window.location = "http://discordonlinejammingcentral.com/memberlist.php"; + break; + case "calendar": + window.location = "http://discordonlinejammingcentral.com/calendar.php"; + break; + case "help": + window.location = "http://discordonlinejammingcentral.com/misc.php?action=help"; + break; + case "songList": + // Implement if dynamic + break; + } + navSelect = op; +} + +function sortButtons() { + document.querySelectorAll("#directoryHeader .name")[0].onclick = function() { + sort.name = sort.name * -1; + sortFiles("name", sort.name); + }; + document.querySelectorAll("#directoryHeader .date")[0].onclick = function() { + sort.date = sort.date * -1; + sortFiles("date", sort.date); + }; + document.querySelectorAll("#directoryHeader .size")[0].onclick = function() { + sort.size = sort.size * -1; + sortFiles("size", sort.size); + }; +} + +function visualize(url) { + if(!spectrum) return; + vis = new Visualizer(); + vis.ini(); + vis._visualize(url, document.getElementById("visualize"), document.getElementsByTagName("audio")[0]); +} + +function playFile(url, name) { + var audio = document.getElementsByTagName("audio")[0]; + document.querySelectorAll("#playback h2")[0].innerText = name; + document.querySelectorAll("#info a")[0].href = url; + audio.src = url; + document.querySelectorAll("#speed i")[0].click(); + audio.play(); + if(vis) { + (spectrum) ? vis._restart() : vis._stop(); + } else { + visualize(url); + } +} + +function checkHash() { + if(window.location.hash) { + currDir = window.location.hash.replace(/[_]+/g, " ").replace(/[\*]+/g,"/").replace("#",""); + } + listDir(currDir,0); + window.location.hash = ""; +} + +function audioControls() { + var audio = document.getElementsByTagName("audio")[0]; + document.querySelectorAll("#speed input")[0].oninput = function() { + audioSettings.speed = (this.value/50) + 0.5; + audio.playbackRate = audioSettings.speed; + }; + document.querySelectorAll("#speed i")[0].onclick = function() { + audio.playbackRate = 1; + document.querySelectorAll("#speed input")[0].value = "25"; + }; + document.querySelectorAll("#volume input")[0].oninput = function() { + audioSettings.volume = this.value/100; + if(audioSettings.volume >= 2/3) document.querySelectorAll("#volume i")[0].className = "fa fa-volume-up transition"; + if(audioSettings.volume < 2/3 && audioSettings.volume >= 1/3) document.querySelectorAll("#volume i")[0].className = "fa fa-volume-down transition"; + if(audioSettings.volume < 1/3) document.querySelectorAll("#volume i")[0].className = "fa fa-volume-off transition"; + audio.volume = audioSettings.volume; + }; + document.querySelectorAll("#volume i")[0].onclick = function() { + audioSettings.mute = !audioSettings.mute; + audio.volume = (audioSettings.mute) ? 0 : audioSettings.volume; + (audioSettings.mute) ? this.style.color = "#ff1a1a" : this.style.color = "white"; + }; + document.querySelectorAll("#pause")[0].onclick = function() { + if(audio.src === "") return; + if(audio.paused) { + audio.play(); + this.className = "fa fa-pause-circle transition"; + } else { + audio.pause(); + this.className ="fa fa-play-circle transition"; + } + }; + audio.ontimeupdate = function() { + if(isNaN(audio.duration)) return; + var end = Math.floor(audio.duration%60).toString(); + if(end.length === 1) end = "0"+end; + var played = Math.floor(audio.currentTime%60).toString(); + if(played.length === 1) played = "0"+played; + document.querySelectorAll("#tracker p")[0].innerText = Math.floor(audio.currentTime/60)+":"+played; + document.querySelectorAll("#tracker p")[1].innerText = Math.floor(audio.duration/60)+":"+end; + document.querySelectorAll("#tracker input")[0].value = Math.floor(100000*audio.currentTime/audio.duration); + }; + document.querySelectorAll("#tracker input")[0].oninput = function() { + if(audio.src === "") { + this.value = "0"; + return; + } + var curr = audio.duration*this.value/100000; + var currRead = Math.floor(curr%60); + if(currRead.length === 1) currRead = "0"+currRead; + document.querySelectorAll("#tracker p")[0].innerText = Math.floor(curr/60)+":"+currRead; + audio.currentTime = curr; + }; + document.querySelectorAll("#spectrum p")[0].onclick = function() { + spectrum = !spectrum; + if(spectrum) { + document.querySelectorAll("#spectrum i")[0].className = "fa fa-check-circle"; + document.getElementsByTagName("canvas")[0].style.display = "block"; + } else { + document.querySelectorAll("#spectrum i")[0].className = "fa fa-times-circle"; + document.getElementsByTagName("canvas")[0].style.display = "none"; + } + if(vis) { + (spectrum) ? vis._restart() : vis._stop(); + } else { + visualize(url); + } + }; + document.getElementById("prev").onclick = function() { + try { + if(selectDiv == undefined) { + return; + } else { + newDiv = selectDiv.previousElementSibling; + while(newDiv.getAttribute("ext") === "fol") newDiv = newDiv.previousElementSibling; + newDiv.click(); + newDiv.click(); + } + } catch(err) {} + }; + document.getElementById("next").onclick = function() { + try { + if(selectDiv == undefined) { + newDiv = document.getElementById("directoryCont").childNodes[0]; + } else { + newDiv = selectDiv.nextElementSibling; + } + while(newDiv.getAttribute("ext") === "fol") newDiv = newDiv.nextElementSibling; + newDiv.click(); + newDiv.click(); + } catch(err) {} + }; +} + +document.addEventListener("keydown", function(event) { + try { + switch((event || window.event).keyCode) { + case 13: + selectDiv.click(); + break; + case 38: + selectDiv.previousElementSibling.click(); + break; + case 40: + if(selectDiv == undefined) { + document.getElementById("directoryCont").childNodes[0].click(); + } else { + selectDiv.nextElementSibling.click(); + } + break; + case 8: + var subdirs = document.getElementsByClassName("subdir"); + subdirs[subdirs.length-1].click(); + break; + case 32: + var audio = document.getElementsByTagName("audio")[0]; + if(audio.paused) { + audio.play(); + document.querySelectorAll("#pause")[0].className = "fa fa-pause-circle transition"; + } else { + audio.pause(); + document.querySelectorAll("#pause")[0].className ="fa fa-play-circle transition"; + } + break; + } + } catch(err) {} +}); + + +getData(); +createNav(); +updateMain(navSelect); +sortButtons(); +audioControls(); \ No newline at end of file diff --git a/DOJC Songs/desktop/visualizer.js b/DOJC Songs/desktop/visualizer.js new file mode 100644 index 0000000..182f2fc --- /dev/null +++ b/DOJC Songs/desktop/visualizer.js @@ -0,0 +1,123 @@ + +var Visualizer = function() { + this.file = null, //the current file + this.fileName = null, //the current file name + this.audioContext = null, + this.source = null, //the audio source + this.info = document.getElementById('info').innerHTML, //this used to upgrade the UI information + this.infoUpdateId = null, //to sotore the setTimeout ID and clear the interval + this.animationId = null, + this.status = 0, //flag for sound is playing 1 or stopped 0 + this.forceStop = false, + this.allCapsReachBottom = false +}; + + +Visualizer.prototype = { + ini: function() { + this._prepareAPI(); + }, + _prepareAPI: function() { + //fix browser vender for AudioContext and requestAnimationFrame + window.AudioContext = window.AudioContext || window.webkitAudioContext || window.mozAudioContext || window.msAudioContext; + window.requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.msRequestAnimationFrame; + window.cancelAnimationFrame = window.cancelAnimationFrame || window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame || window.msCancelAnimationFrame; + try { + this.audioContext = new AudioContext(); + } catch (e) { + alert('!Your browser does not support AudioContext', false); + console.log(e); + } + }, + _visualize: function(url, canvas, audio) { + var audioContext = this.audioContext, + audioBufferSouceNode = audioContext.createMediaElementSource(audio), + analyser = audioContext.createAnalyser(), + that = this; + this.analyser = analyser; + this.canvas = canvas; + //connect the source to the analyser + audioBufferSouceNode.connect(analyser); + //connect the analyser to the destination(the speaker), or we won't hear the sound + analyser.connect(audioContext.destination); + //then assign the buffer to the buffer source node + //play the source + if (!audioBufferSouceNode.start) { + audioBufferSouceNode.start = audioBufferSouceNode.noteOn //in old browsers use noteOn method + audioBufferSouceNode.stop = audioBufferSouceNode.noteOff //in old browsers use noteOn method + }; + //stop the previous sound if any + if (this.animationId !== null) { + cancelAnimationFrame(this.animationId); + } + if (this.source !== null) { + this.source.stop(0); + } + //audioBufferSouceNode.start(0); + this.status = 1; + this.source = audioBufferSouceNode; + this._drawSpectrum(analyser, canvas); + }, + _restart: function() { + this._drawSpectrum(this.analyser, this.canvas); + }, + _stop: function() { + cancelAnimationFrame(this.animationId); + }, + _drawSpectrum: function(analyser, canvas) { + var that = this, + monoL = canvas, + //monoR = document.getElementById('mono-R'), + cwidth = monoL.width, + cheight = monoL.height - 3, + meterWidth = 1, //width of the meters in the spectrum + gap = 0.01, //gap between meters + capHeight = 2, + capStyle = '#fff', + meterNum = 20 * (2 + 2), //count of the meters + capYPositionArray = []; ////store the vertical position of hte caps for the preivous frame + ctx = monoL.getContext('2d'), + gradient = ctx.createLinearGradient(0, 0, 0, 300); + gradient.addColorStop(1, themeColors.highlight); + gradient.addColorStop(0, '#fff'); + + var drawMeter = function() { + var array = new Uint8Array(analyser.frequencyBinCount); + analyser.getByteFrequencyData(array); + if (that.status === 0) { + //fix when some sounds end the value still not back to zero + for (var i = array.length - 1; i >= 0; i--) { + array[i] = 0; + }; + allCapsReachBottom = true; + for (var i = capYPositionArray.length - 1; i >= 0; i--) { + allCapsReachBottom = allCapsReachBottom && (capYPositionArray[i] === 0); + }; + if (allCapsReachBottom) { + cancelAnimationFrame(that.animationId); //since the sound is top and animation finished, stop the requestAnimation to prevent potential memory leak,THIS IS VERY IMPORTANT! + return; + }; + }; + var step = Math.round(array.length / meterNum); //sample limited data from the total array + ctx.clearRect(0, 0, cwidth, cheight); + for (var i = 0; i < meterNum; i++) { + var value = array[i * step]; + if (capYPositionArray.length < Math.round(meterNum)) { + capYPositionArray.push(value); + }; + ctx.fillStyle = capStyle; + //draw the cap, with transition effect + if (value < capYPositionArray[i]) { + ctx.fillRect(i * 12, cheight - (--capYPositionArray[i]), meterWidth, capHeight); + } else { + ctx.fillRect(i * 12, cheight - value, meterWidth, capHeight); + capYPositionArray[i] = value; + }; + ctx.fillStyle = gradient; //set the filllStyle to gradient for a better look + ctx.fillRect(i * 12 /*meterWidth+gap*/ , cheight - value + capHeight, meterWidth, cheight); //the meter + } + that.animationId = requestAnimationFrame(drawMeter); + } + this.animationId = requestAnimationFrame(drawMeter); + } +} \ No newline at end of file diff --git a/DOJC Songs/header.html b/DOJC Songs/header.html new file mode 100644 index 0000000..8a1c33e --- /dev/null +++ b/DOJC Songs/header.html @@ -0,0 +1,43 @@ + + + + + + DOJC Mixtapes + + + + + + + + + + + diff --git a/DOJC Songs/logo.png b/DOJC Songs/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..da15bd277fdf4fb8f518eb29f8b106a17069801f GIT binary patch literal 87907 zcmeHQ2Ut``*S?6NAS(85R_uk|1Q8YNiWMVjjIOXCDuPI2N%YegjqTH@v6mPVWADB9 z-h08`D?|Z75%}Nt%EjdhyDKb8{%_}b7H*k2bLPxBXU?2CGk0v;)=dkTl`#_pp+NIy zjoJ%>Q9fLI<}<9O9_Hmn;Z=ljLD%MW2=wXjq(r^An=zg(#|;0iWk~zt`4sIv#}6+yxoXXdrWP&6 zRQ%&=@pgL)H*TD}?2!dyj3-VUKB0KK+UDcTuH?O6apA;~e~uYYz79<7L;xBhhAJ^9S1H*;v`G~9ftXNAJIM;<3J+86fYbz8BXnDX@xMC&PHt!VBOjxs7*mKGv|2iR`xnSFF%%~bd?jM96M=Dhs zB>X%}DAwdvC-;}NR#`l%2};dc=f1VFYvU1J^I7%J+o_Xvh3co8m#kIHS(!^YyMgt- z!Lv%+k8mt>JNkqmESOvzt&L6`bgJO0Q>UCKZYtQ_>gjHiWXqmC?zWJ?PFh$cGIy_U^Dp==ZhXMHLJc+w3!Yr-6dg+1H2&k)tyix;xPSjj zivylrmB%^_O$yxCeNU&vzHf%Pzl)2#z3Xn}5%%3iG|e4ISFfe zdl>yN*=k8QKjYUet6BJl@3|W%2(Pw>?7dJupYiZsBk!CZm>g9dEjuEE08y?A5R9W%b z7^9x!d@D`NS8~><_=q9>(V6AF z3SFDz;dR({&*M^g9S-!hwLY}pb8Vg4rc?cnueDrZzWh*`HD9kV-aaZw zyvNiz_drjDvO>dVzO8&)Uum{PQLeIM;cKQYrp7XMcls%|U%=0K^Q_IAJc zHmhCfQjtkTZ7hBm<8{ELa*?rK_SLrjnydNRzkJRWIoIS|zxI`$)LuHrv00f)Q;%Nr z@3Sti>uG9&df*W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A2R{!5GaBDGSqmPHqr;f{ zjIt}`2nE4;Bbdq#r%|uOQsfylHoKIANJsb|_MSU`J^}0STz`MR4yq>#b3L3+Ju-zh zCeB2aG*L4>5>o2voW;}%XXM03gV~NDXlfhg&lmRW*>eqB#S_pES+;zrTwqB(#~zW* z7`e~E7f=(^#kO$RwZ#;&j4tg4e({Ja*agdE8T#lLgyJU3^4le;z7K71D4gJ}7Z9d3 zP%4*!Pc3{Bp+CMR<^*$JV=xtIb@}q;<8aC@!>GRlLUfUldugWJ!5!m~zG-S{n3E-7tne zF@i(-IF!I?1TDSB^*tz(0Uz$FrWaugAwKsn+b6yys|Vd)gkDlY0Y(sZ386a*ZRg>cZzFSl;rzOD&b zeZ4a?HC+Io{5Hfz|BBA}qEExFmrF_u+88j{v807_4@I z9*p`GDP-MWs1U?zS${TKqB=J%M<@tr(!Q7vch?!~EM^1)#9;KuhkX;N zpHR;t$TY>-$z(QtPhZkhVz@C-;4@GlM<@tgbZrvYo9)cO? zmD!b&5i3vwM~AVF&utcFSDOrQ|Mw`6BNPPo%08o6m)!|wTO^!Brr6g}8rR~^&TOqS z#aztRIt;)K6v##j zlm1*=*@>kAwt)f}Qy^EyuRh-!%++^b$>~LQ)dH(lQiN7Up$fdK(Mnl)>73XyCUsOz&V zrRuvK26zSvdup?6$(Xrz}g1O;RbfrnB!>bgyf_o z!-|3$fen`i3VaF$a+HEdSyD*A=e_SEa6hU@(V|`mlz4!c)XkVOP$5KP${>a+Qb{lh z348nsV7uKj#HL=w7jn3%BM*WdazQb~5S}3!C}5yK<|zOfN=^>?JNM63%3G-jrg`Jm LjaGT~`04)ufDFhP literal 0 HcmV?d00001 diff --git a/DOJC Songs/mobile/mobile.css b/DOJC Songs/mobile/mobile.css new file mode 100644 index 0000000..16b2698 --- /dev/null +++ b/DOJC Songs/mobile/mobile.css @@ -0,0 +1,263 @@ +html { + height: 100%; + width: 100%; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +body { + display: grid; + height: 100%; + overflow: hidden; + padding: 0; + margin: 0; + color: white; + font-family: 'Open Sans Condensed', sans-serif; + grid-template-columns: 100%; + grid-template-rows: 8% 6% auto; +} + +h1, h2, h3, h4, h5, p { + margin: 0; +} + +a { + text-decoration: none; +} + +.transition { + -webkit-transition: all 0.3s cubic-bezier(.25, .8, .25, 1); + transition: all 0.3s cubic-bezier(.25, .8, .25, 1); + -moz-transition: all 0.3s cubic-bezier(.25, .8, .25, 1); + -ms-transition: all 0.3s cubic-bezier(.25, .8, .25, 1); +} + +#header { + display: grid; + grid-row: 1; + grid-template-columns: 7vh auto 7vh; + background-color: #151313; +} + +#header div { + margin: auto; + font-size: 3vh; + border-radius: 50px; +} + +#header div .fa { + padding: 1.5vh; +} + +#header img { + height: 60%; + margin: auto 0 auto 0; +} + +#mainContainer { + grid-row: 3; + background-color: #070606; + overflow-y: auto; +} + +#sidebar { + position: absolute; + left: -80%; + height: 100%; + width: 60%; + background-color: #151313; + box-shadow: 1px 0px 12px 1px black; +} + +#sidebar div:nth-child(2) { + margin-top: 20%; +} + +#sidebar span { + font-size: 110%; + padding: 5%; + position: absolute; + bottom: 0; +} + +#sidebar span p { + cursor: pointer; + color: #63d4ff; + display: inline; +} + +.navi { + display: grid; + height: 6vh; + width: 100%; + cursor: pointer; + grid-template-columns: 1fr 3fr 7fr; +} + +.naviInner { + background-color: rgba(0,0,0,0.15); +} + +.naviInner div { + display: grid; + height: 4vh; + width: 100%; + cursor: pointer; + grid-template-columns: 3fr 7fr; +} + +.navi:hover, .naviInner div:hover { + background-color: rgba(255, 255, 255, 0.1) !important +} + +.navi i { + margin: auto 0 auto 0; + font-size: 2.1vh; + text-align: center; + grid-column: 2; +} + +.navi p { + margin: auto 0 auto 0; + font-size: 2vh; + grid-column: 3; +} + +.naviInner p { + margin: auto 0 auto 0; + font-size: 2vh; + grid-column: 2; +} + +#directoryHeader { + grid-row: 2; + background: rgba(0,0,0,0.7); + display: grid; + grid-template-columns: 50% auto 10% 7%; +} + +#directoryHeader p:nth-child(2) { + grid-column: 3; + opacity: 0; + margin: auto; +} + +#location { + margin: auto 0 auto 5%; + grid-column: 1; +} + +#directoryHeader i { + grid-column: 4; + opacity: 0; + margin: auto; +} + +.item { + display: grid; + padding: 2%; + grid-template-columns: 14% auto 10%; + grid-template-rows: 60% 40%; + border-bottom: 1px solid white; +} + +.item .name { + grid-row: 1; + grid-column: 2; + font-size: 120%; +} + +.item .modified { + grid-row: 2; + grid-column: 2; + font-size: 80%; + color: rgba(255,255,255,0.5); +} + +.item div { + grid-row: 1 / 3; + grid-column: 3; + margin: auto; + border-radius: 50px; +} + +.fileIcon { + grid-column: 1 !important; + background-color: rgba(255,255,255,0.1); + margin: auto auto auto 0 !important; +} + +.item div .fa { + padding: 1.5vh; +} + +#copy { + opacity: 0; + position: absolute; + top: -50%; +} + +#dotMenu { + display: none; + opacity: 0; + position: absolute; + top: 2vh; + right: 2vh; + font-size: 2.5vh; + width: 40%; +} + +#dotMenu p, #dotMenu a { + display: block; + padding: 10% 40% 10% 13%; +} + +#dotMenu a { + color: rgba(0,0,0,0.5); +} + +.card { + border-radius: 2px; + background-color: #FEFEFE; + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24); + color: black; + transition: all 0.3s cubic-bezier(.25, .8, .25, 1); +} + +#menuOverlay { + background-color: rgba(0,0,0,0.2); + position: absolute; + width: 100%; + height: 100%; + display: none; +} + +#optionContainer { + width: 100%; + position: absolute; + bottom: -60%; + background-color: white; +} + +#optionContainer p { + color: black; + font-size: 2.5vh; + padding: 3%; +} + +#optionContainer p:first-child { + color: rgba(0,0,0,0.7); +} + +.overlay .fa-times { + font-size: 4vh; + position: absolute; + right: 4vh; + top: 4vh; + color: white; + cursor: pointer; +} \ No newline at end of file diff --git a/DOJC Songs/mobile/mobile.html b/DOJC Songs/mobile/mobile.html new file mode 100644 index 0000000..8ce8908 --- /dev/null +++ b/DOJC Songs/mobile/mobile.html @@ -0,0 +1,38 @@ + +

+
+

BinBin

+

Name

+ +
+ +
+
+
+
+
+
+
+

Sort by...

+ Download +
+ + + \ No newline at end of file diff --git a/DOJC Songs/mobile/mobile.js b/DOJC Songs/mobile/mobile.js new file mode 100644 index 0000000..a24d325 --- /dev/null +++ b/DOJC Songs/mobile/mobile.js @@ -0,0 +1,559 @@ +var data, // Stores data from PHP. + section = 0, + clickable = true, + selectName, // Stores name of folder in selected div + selectDiv, // Stores actual selected div. + currDir = ""; + +var sort = { + "name": -1, + "date": 1, + "size": 1, +}; + +var faIcons = { + "fol": "folder", + "mp3": "music", + "ogg": "music", + "other": "file", + "wav": "music" +}; + +var navi = [ // Necessary arguments: id, alias, fa | Optional arguments: subnav. + { + "id": "home", + "alias": "Home", + "fa": "home" + }, + { + "id": "forums", + "alias": "Forums", + "fa": "file" + }, + { + "id": "memberList", + "alias": "Member List", + "fa": "users" + }, + { + "id": "calendar", + "alias": "Calendar", + "fa": "calendar" + }, + { + "id": "help", + "alias": "Help", + "fa": "info-circle" + }, + { + "id": "songList", + "alias": "Song List", + "fa": "music" + } +]; + +var navSelect = "songList"; + +var themeColors = { // For reference and for quick changing if need-be. + "main": "#070606", + "sidebar": "#151313", + "highlight": "#63d4ff" +}; + +function getData() { + $.when($.ajax({ + type : 'POST', + url: 'api.floofy.php', + data: {rootdir: 'rootdir'} + })).done(function(d) { + rootDir = d; + checkHash(); + }); +} + +function listDir(dir, sec) { // Directory is the sub-directory, sec is the section of data, if files need to be split up into sections. + var real = rootDir+dir; + $.when($.ajax({ + type : 'POST', + url: 'api.floofy.php', + data: {getdir : [real, sec]}, + })).done(function(d) { + data = d; + if(data[0] === null) { + currDir = ""; + listDir(currDir, 0); + return; + } + if(sec == 0) { + data[0].splice(0,2); + data[1].splice(0,3); + data[2].splice(0,3); + data[3].splice(0,3); + } else { + data[1].splice(0,1); + data[2].splice(0,1); + data[3].splice(0,1); + } + var toObj = []; + for(var i = 0; i < data[0].length; i++) { + toObj.push({ + name: data[0][i], + folder: data[1][i], + date: data[2][i], + size: data[3][i] + }); + } + data = toObj; + sortFiles("name", -1); + clickable = true; + }); +} + +function sortFiles(type, direction) { + switch(type) { + case "name": + data.sort(function(a, b){ return (a.name < b.name) ? direction*1 : direction*-1;}); + break; + case "date": + data.sort(function(a, b){ + a = a.date.replace(",","").split(" "); + b = b.date.replace(",","").split(" "); + a = Date.parse(a[1] + " " + a[0] + " " + a[2]); + b = Date.parse(b[1] + " " + b[0] + " " + b[2]); + + return (a < b) ? direction*1 : direction*-1; + }); + break; + case "size": + data.sort(function(a, b){ return (a.size.replace("B","").substring(0, a.size.length-1) < b.size.replace("B","").substring(0, b.size.length-1)) ? direction*1 : direction*-1;}); + } + var p = document.querySelectorAll("#directoryHeader p:nth-child(2)")[0]; + var i = document.querySelectorAll("#directoryHeader i")[0]; + p.style.opacity = "0"; + i.style.opacity = "0"; + setTimeout(function() { + p.innerText = type[0].toUpperCase() + type.substring(1,type.length); + i.className = "fa fa-arrow-" + ((direction < 0) ? "up" : "down") + " transition"; + p.style.opacity = "1"; + i.style.opacity = "1"; + }, 300); + + try { + clearTbl(); + setTimeout(function() { + document.getElementById("directory").removeChild(document.getElementById("directoryCont")); + dispDir(); + }, 300); + } catch(err) { + dispDir(); + } +} + +function dispDir() { + updateLocation(); + try { + document.getElementById("directory").removeChild(document.getElementById("directoryCont")); + } catch(err) {} + var cont = document.createElement("div"); + cont.id = "directoryCont"; + cont.style.opacity = "0"; + cont.className = "transition"; + + selectName = ""; + var item; + if(data.length === 0) { + var p = document.createElement("p"); + p.appendChild(document.createTextNode("Nothing here!")); + p.style.fontWeight = "100"; + cont.appendChild(p); + } + for(var i = 0; i < data.length; i++) { + item = createRow(); + + var curr = data[i]; + var name = document.createTextNode(curr.name); + var otherInfo = document.createTextNode(curr.date.split(" | ")[0] + " | " + curr.size); + + item.childNodes[0].appendChild(name); + item.childNodes[1].appendChild(otherInfo); + + var ext = document.createAttribute("ext"); + + if(curr.folder == "true") { + ext.value = "fol"; + } else { + ext.value = curr.name.substring(curr.name.lastIndexOf(".")+1,curr.name.length).toLowerCase(); + } + item.setAttributeNode(ext); + + var ico = document.createElement("div"); + ico.className = "fileIcon"; + var faico = document.createElement("i"); + faico.className = "fa fa-" + (faIcons[item.getAttribute("ext")] || faIcons["other"]); + ico.appendChild(faico); + item.appendChild(ico); + + item.onclick = function() { + if(clickable == true) { + var name = this.childNodes[0].innerText; + url = getURI(name); + attr = this.getAttribute("ext"); + var download = document.querySelectorAll("#dotMenu a")[0] + if(attr == "fol") { + download.href = "" + download.style.color = "rgba(0,0,0,0.5)"; + } else { + download.href = url; + download.style.color = "rgba(0,0,0,1)"; + } + if(selectName == name) { + clickable = false; + attr = this.getAttribute("ext"); + if(attr == "fol") { + clearTbl(); + setTimeout(function() { + currDir += name+"/"; + listDir(currDir,0); + }, 300) + return; + } else { + audioOverlay(url); + clickable = true; + } + } + selectName = name; + selectDiv = this; + for(var i =0; i < document.getElementsByClassName("item").length;i++){ + document.getElementsByClassName("item")[i].style.backgroundColor = ""; + } + this.style.backgroundColor = "rgba(255,255,255,0.2)"; + } + } + cont.appendChild(item); + item = null; + } + document.getElementById("directory").appendChild(cont); + setTimeout(function() { + document.getElementById("directoryCont").style.opacity = "1"; + }, 100); +} + +function getClose() { + var close = document.createElement("i"); + close.className = "fa fa-times transition"; + var attr = document.createAttribute("aria-hidden"); + attr.value = "true"; + close.setAttributeNode(attr); + + close.onclick = function() { + this.style.color = "#f13838"; + that = this; + document.getElementsByClassName("overlay")[0].opacity = "0"; + setTimeout(function() { + that.style.color = "white"; + document.getElementsByTagName("body")[0].removeChild(document.getElementsByClassName("overlay")[0]); + clickable = true; + }, 300); + }; + + return close; +} + +function createRow() { + var item = document.createElement("div"); + item.className = "item transition"; + var name = document.createElement("p"); + name.className = "name"; + item.appendChild(name); + var modified = document.createElement("p"); + modified.className = "modified"; + item.appendChild(modified); + return item; +} + +function audioOverlay(url) { + var overlay = getDefaultOverlay(); + var audio = document.createElement("audio"); + audio.onclick = function() {event.stopPropagation();} + audio.src = url; + audio.controls = true; + audio.autoplay = true; + + audio.style.margin = "auto"; + audio.style.width = (window.innerWidth * 0.9).toString() + "px"; + + var div = document.createElement("div"); + div.style.margin = "auto"; + div.style.gridRow = "1"; + div.style.gridColumn = "1"; + div.appendChild(audio); + overlay.appendChild(div); + + var close = getClose(); + overlay.appendChild(close); + + document.getElementsByTagName("body")[0].appendChild(overlay); + setTimeout(function() { + overlay.style.opacity = "1"; + }, 10); +} + +function getDefaultOverlay() { + var overlay = document.createElement("div"); + overlay.className = "overlay transition"; + overlay.style.position = "absolute"; + overlay.style.top = "0"; + overlay.style.left = "0"; + overlay.style.minHeight = "100%"; + overlay.style.minWidth = "100%"; + overlay.style.background = 'rgba(0,0,0,0.8)'; + overlay.style.zIndex = "50"; + overlay.style.display = "grid"; + overlay.style.gridTemplateColumns = "1fr"; + overlay.style.gridTemplateRows = "1fr"; + overlay.style.opacity = "0"; + + return overlay; +} + +function clearTbl() { + selected = undefined; + selectDiv = undefined; + document.getElementById("directoryCont").style.opacity = "0"; +} + +function getURI(name) { + var dirs = (rootDir+currDir+name).split("/"); + var uri = window.location.origin; + for(var i = 1; i < dirs.length; i++) uri+="/"+encodeURIComponent(dirs[i]); + return uri; +} + +function createNav() { + for (var i = 0; i < navi.length; i++) { // Create navigation tabs. + var side = document.getElementById("sidebar"); + var div = document.createElement("div"); + div.className = "navi transition"; + div.setAttribute("option", navi[i].id); + var ic = document.createElement("i"); + ic.className = "fa fa-" + navi[i].fa; + ic["aria-hidden"] = true; + var p = document.createElement("p"); + p.appendChild(document.createTextNode(navi[i].alias)); + div.appendChild(ic); + div.appendChild(p); + side.appendChild(div); + var subNav = navi[i].subNav; + if(!subNav) continue; + + var subNavCont = document.createElement("div"); + subNavCont.className = "naviInner"; + subNavCont.setAttribute("option", navi[i].id); + for(var j = 0; j < subNav.length; j++) { + var eachSubNav = document.createElement("div"); + eachSubNav.className = "transition"; + eachSubNav.setAttribute("option", navi[i].id+"&"+subNav[j].id); + eachSubNav.onclick = function() { + var op = this.getAttribute("option"); + if(subNavSelect === op) return; + //updateMain(op); + } + var p2 = document.createElement("p"); + p2.appendChild(document.createTextNode(subNav[j].alias)); + eachSubNav.appendChild(p2); + subNavCont.appendChild(eachSubNav); + } + side.appendChild(subNavCont); + } +} + +function updateNav(op) { // Updates the sidebar navigation (if naviagation tabs are ever dynamically implemented). + var oldNav = document.querySelectorAll("[option=" + navSelect + "]")[0]; + var newNav = document.querySelectorAll("[option=" + op + "]")[0]; + oldNav.style.backgroundColor = "rgba(0,0,0,0)"; + oldNav.style.color = "white"; + newNav.style.backgroundColor = themeColors.main; + newNav.style.color = themeColors.highlight; +} + +function updateMain(op) { // Updates the actual page. + updateNav(op); + switch(op) { + case "home": + window.location = "http://discordonlinejammingcentral.com/"; + break; + case "forums": + window.location = "http://discordonlinejammingcentral.com/"; + break; + case "memberList": + window.location = "http://discordonlinejammingcentral.com/memberlist.php"; + break; + case "calendar": + window.location = "http://discordonlinejammingcentral.com/calendar.php"; + break; + case "help": + window.location = "http://discordonlinejammingcentral.com/misc.php?action=help"; + break; + case "songList": + // Implement if dynamic + break; + } + navSelect = op; +} + +function updateLocation() { + window.location.hash = currDir.replace(/[\/]+/g,"*").replace(/ /g, "_"); + var i = document.querySelectorAll("#header div:first-child i")[0]; + document.getElementById("location").innerText = (currDir === "") ? "BinBin" : currDir.split("/").slice(-2)[0]; + if(currDir === "" && !i.className.includes("fa-bars")) { + i.style.opacity = "0"; + setTimeout(function() { + i.className = "fa fa-bars transition"; + i.style.opacity = "1" + }, 300); + } else if(currDir !== "" && !i.className.includes("fa-arrow-left")) { + i.style.opacity = "0"; + setTimeout(function() { + i.className = "fa fa-arrow-left transition"; + i.style.opacity = "1"; + }, 300); + } +} + +function checkHash() { + console.log(window.location.hash); + if(window.location.hash) { + currDir = window.location.hash.replace(/[_]+/g, " ").replace(/[\*]+/g,"/").replace("#",""); + } + listDir(currDir,0); + window.location.hash = ""; +} + +function closeMenuOverlay() { + var overlay = document.getElementById("menuOverlay"); + overlay.style.opacity = "0"; + setTimeout(function() { + overlay.style.display = "none"; + }, 300); + document.getElementById("optionContainer").style.bottom = "-60%"; +} + +function sortButtons() { + document.querySelectorAll("#optionContainer p:first-child")[0].onclick = function() {event.stopPropagation();} + document.querySelectorAll("#optionContainer p:nth-child(2)")[0].onclick = function() { + event.stopPropagation(); + closeMenuOverlay(); + sort.name = sort.name * -1; + sortFiles("name", sort.name); + } + document.querySelectorAll("#optionContainer p:nth-child(3)")[0].onclick = function() { + event.stopPropagation(); + closeMenuOverlay(); + sort.date = sort.date * -1; + sortFiles("date", sort.date); + } + document.querySelectorAll("#optionContainer p:nth-child(4)")[0].onclick = function() { + event.stopPropagation(); + closeMenuOverlay(); + sort.size = sort.size * -1; + sortFiles("size", sort.size); + } + document.querySelectorAll("#directoryHeader p:nth-child(2)")[0].onclick = function() { + var type = this.innerText.toLowerCase(); + sort[type] = sort[type] * -1; + sortFiles(type, sort[type]); + } +} + +document.querySelectorAll("#header div:first-child i")[0].onclick = function() { + this.parentNode.style.backgroundColor = "rgba(0,0,0,0.4)"; + that = this; + setTimeout(function() { + that.parentNode.style.backgroundColor = "rgba(0,0,0,0)"; + }, 300); + if(currDir === "") { + console.log("asdf"); + setTimeout(function() { + document.getElementById("sidebar").style.left = "0"; + }, 10); + + } else { + var arr = currDir.split("/"); + if(arr.length === 2) { + currDir = ""; + } else { + currDir = arr.slice(0,arr.length-2).reduce((a,b) => a+"/"+b)+"/"; + } + listDir(currDir, 0); + } +} + +document.querySelectorAll("#header div:last-child i")[0].onclick = function(event) { + event.stopPropagation(); + this.parentNode.style.backgroundColor = "rgba(0,0,0,0.4)"; + that = this; + setTimeout(function() { + that.parentNode.style.backgroundColor = "rgba(0,0,0,0)"; + }, 300); + var menu = document.getElementById("dotMenu"); + menu.style.display = "block"; + setTimeout(function() { + menu.style.opacity = "1"; + }, 10); +} + +document.getElementById("sidebar").onclick = function() { + event.stopPropagation(); +} + +document.getElementById("openSort").onclick = function() { + event.stopPropagation(); + this.style.backgroundColor = "rgba(0,0,0,0.2)"; + that = this; + setTimeout(function() { + that.style.backgroundColor = "rgba(0,0,0,0)"; + }, 300); + // Close Menu + var menu = document.getElementById("dotMenu"); + menu.style.opacity = "0"; + setTimeout(function() { + menu.style.display = "none"; + }, 300); + // Open overlay + var overlay = document.getElementById("menuOverlay"); + overlay.style.display = "block"; + setTimeout(function() { + overlay.style.opacity = "1"; + }, 10); + + setTimeout(function() { + var option = document.getElementById("optionContainer"); + option.style.bottom = "0"; + }, 150); +} + +document.getElementById("download").onclick = function() { + event.stopPropagation(); + this.style.backgroundColor = "rgba(0,0,0,0.2)"; + that = this; + setTimeout(function() { + that.style.backgroundColor = "rgba(0,0,0,0)"; + }, 300); +} + +document.onclick = function(event) { + var menu = document.getElementById("dotMenu"); + menu.style.opacity = "0"; + setTimeout(function() { + menu.style.display = "none"; + }, 300); + + closeMenuOverlay(); + + document.getElementById("sidebar").style.left = "-80%"; +} + +getData(); +sortButtons(); +createNav(); +updateNav(navSelect); \ No newline at end of file diff --git a/Google FooBar/boomBaby.py b/Google FooBar/boomBaby.py new file mode 100644 index 0000000..1752082 --- /dev/null +++ b/Google FooBar/boomBaby.py @@ -0,0 +1,24 @@ +def gcd(a, b): + while b > 0: + a, b = b, a % b + return a + +def solution(x, y): + x, y = int(x), int(y) + if y < x: x, y = y, x # Reorder + + count = 0 + while True: + div = y/x + print(x,y) + if x == 1: + count += y-1 + break + y -= x*div + count += div + if y < x: x, y = y, x + if x == y or x < 1: return "impossible" + + return str(count) + +print(solution(4, 7)) \ No newline at end of file diff --git a/Google FooBar/bunnyMessage.py b/Google FooBar/bunnyMessage.py new file mode 100644 index 0000000..1fd515e --- /dev/null +++ b/Google FooBar/bunnyMessage.py @@ -0,0 +1,48 @@ +from itertools import combinations + +def swap(l, i, j): + a, b = l[i], l[j] + l[j] = a + l[i] = b + + +def to_int(l): + # Coverts list of digits to integer. + n = 0 + for i, x in enumerate(reversed(l)): n += x * 10**i + return n + + +def next_greatest(l): + # Finds the next greatest number with the same set of digits. + + # First, the first index (from the right) where Left > Right digit. + for i in range(len(l)-1, -1, -1): + if l[i] < l[i-1]: break + + if i == 0: return 0 # No digits, found, smallest possible. + + # Find the largest number to the right of that index, including, + # and swap. Then, sort the right descending. + comp, largest = l[i-1], i + for j in range(i, len(l)): + if l[j] < comp and l[j] > l[largest]: largest = j + + swap(l, i-1, largest) + l = l[:i] + sorted(l[i:], reverse=True) + + +def solution(l): + l = sorted(l, reverse=True) + found = False + for i in range(len(l), 0, -1): + # Get all combinations when removing digits. + c = list(combinations(l, i)) + for m in c: + m = list(m) + while True: + num = to_int(m) + if num % 3 == 0: return num + if not next_greatest(m): break + + return 0 diff --git a/Google FooBar/disorderlyEscape.py b/Google FooBar/disorderlyEscape.py new file mode 100644 index 0000000..a2135bc --- /dev/null +++ b/Google FooBar/disorderlyEscape.py @@ -0,0 +1,90 @@ +# Apply Burnside's Lemma to a group +# G = S_r x S_c. G is a group action on +# the set of R x C matrices with elements +# 1 to n. (S_r, S_c can be thought to +# permute the rows and columns). +# We need only count the total number +# matrices unchanged by a group operation. +# This is the cycle index of S_r x S_c. + +from itertools import permutations + +def fac(n): + a = 1 + for i in range(2, n+1): a *= i + return a + + +def gcd(a, b): + while b > 0: + a, b = b, a % b + return a + + +def mult(l): + v = 1 + for x in l: v *= x + return v + + +def gen_struct(full, l, n, i=0, v=0): + if v >= n: + if v == n: full.append([x for x in l]) + return + if i == n: return + l[i] = (n-v) / (i+1) + for c in range(l[i]): + gen_struct(full, l, n, i+1, v+l[i]*(i+1)) + l[i] -= 1 + gen_struct(full, l, n, i+1, v+l[i]*(i+1)) + + +def cycle_monomials(n): + # Generates the cycle structures of distinct + # lengths of S_n and their number of occurances. + a = range(1, n+1) + perms = permutations(range(1, n+1)) + valid = {} + structs = [] + gen_struct(structs, [0]*n, n) + + for s in structs: + valid[tuple(s)] = distinct_disjoint(n, s) + return valid + + +def distinct_disjoint(n, s): + # Counts distinct number of cycle structures + # given a structure. + a = mult([fac(x)*(i+1)**x for i,x in enumerate(s)]) + return fac(n) / a + + +def precompute_gcds(n): + gcds = {} + for i in range(1, n+1): + for j in range(1, n+1): + gcds[(i,j)] = gcd(i, j) + return gcds + + +def count_pow(w, h, gcds): + p = 0 + for i,x in enumerate(w): + for j,y in enumerate(h): + p += x*y*gcds[(i+1, j+1)] + return p + + +def solution(w, h, s): + gcds = precompute_gcds(w if w > h else h) + cycle_w = cycle_monomials(w) + cycle_h = cycle_monomials(h) + + a = 0 + for m_w in cycle_w: + for m_h in cycle_h: + power = count_pow(m_w, m_h, gcds) + a += cycle_w[m_w]*cycle_h[m_h]*s**(power) + return str(a/(fac(w)*fac(h))) + diff --git a/Google FooBar/dodgeTheLasers.py b/Google FooBar/dodgeTheLasers.py new file mode 100644 index 0000000..b9bdb50 --- /dev/null +++ b/Google FooBar/dodgeTheLasers.py @@ -0,0 +1,27 @@ +from fractions import Fraction + +s2 = Fraction( + 35332726218913082002358766567827133403671835402604373950214227741215442484749150955273090178912608481198897853368677449335995881087244538678290206830418162774359733435287323797237328954776430706234113433451845011017420071003585630000741417839336284541684996470487244538747886851321045013449097020971979829080007863459398205102274621539252406059437113694061276533416838442752036477377285665580031045075305667660780081786425072132321243484569812363079897761850586673077795635795883465127642978549060248943470341266945351444290281205344606113449121955343732035824675647295545778804839861084648227428027205738691255356908295557230413188833721567060585767808732827617204869412227198237283429379813249866199201416615876892112411524426811419866249990696965745171717817422622562682438363092664485642832947927443151601527359189163417709253561016343488370329029585831327776394329216180144214930909237283637492608470079057271872248952501520874288386823231621192012874782227366578088738868911631337861377623018019037632439341813994901701122235924802807033643138348715789752591317659444556916319088480894501003196095706425280809090500181540773251421775695294520400781732432876502534542845385961208207822267335357830445556698863375695074697445589948526104879367950290305961624127368550768977250835228412091675544074876078513692883156476870744638792993260730998051752445796633655179188384438251649122556708863266126720906055336405070283541885888759326087142666395773249829681135123306671975516588372947658685690152085540674258629344850569601363203602574753855251595448225066391699457, + 24984010307201163339947983356301141616506447664487440183998810625058752168423324876345697485648790341609412002644655629412905132278379217868484556663287775731050845260730078203242599232472745227920679113063794049752437460981417866332131328395755341349753062559392972068081111918344156477612649348595211491067455489237457910155651004107009048180626919290946081541440148801661958564193598020244065505190786402719245384074252704561095281880456896817874403336969582795243258680340898219825513614657448394985422467221011934983262955360496189619472621400284115715288480382270722104540794780523070446693883270347990895469101178377691926263031421481448827494798554741341670262654080173175016283673279935535934852810962006385757200844486464083629290021915870934966800154480166282275001270982689689154583147508681525494843192315422085012166515924290106489737455158618093568404195679968385318684717834082972614221999122177016269590409818014579764679971236940524480753371978831311605588219064932370351315353772791737116335036856123399572239079392444178222707643932212683788067910953111224799145119835497757908787464889401399155223624057578426686398366195576141848364526279398255637945691268246191955996126558409043995911907057399961628590021716196825459819630668018546857838477083355412835636688350256316068114037351274317433071855241661763541825367319352845206312966830268604961919428245071600234081088836304955895409229527078577447991563333997254415362184904418568880688711037556338564582304559403993718370643949781411157627238782780565038167716008066343635609932346552357957632 +) + +s2p = 4142135623730950488016887242096980785696718753769480731766797379907324784621070388503875343276415727 +#Good approximate solution +def sol_approx(s): + x = s2*s*(s+1)/2 - s/2 + return int(x.numerator/x.denominator) + +def beatty(n): + if n == 1: return 1 + if n < 1: return 0 + t = n*s2p/(10**100) + a,b,c = n*t, n*(n+1)/2, t*(t+1)/2 + return a+b-c - beatty(t) + +# Beatty sequence +def solution(s): + #x = sol_approx(int(s)) + x = beatty(int(s)) + return str(x) + +print(solution("1000")) \ No newline at end of file diff --git a/Google FooBar/doomsdayFuel.py b/Google FooBar/doomsdayFuel.py new file mode 100644 index 0000000..ef50e3b --- /dev/null +++ b/Google FooBar/doomsdayFuel.py @@ -0,0 +1,70 @@ +from fractions import Fraction + +def div_row(l, row, m): + for i in range(len(l[row])): l[row][i] = l[row][i] / m + + +def add_row(l, row1, row2, m=1): + for i in range(len(l[row1])): l[row1][i] = l[row1][i] + l[row2][i] * m + + +def process(l): + # Converts matrix to fractions, and gets terminal states. + # Transforms L into (I - L^T) | (1,0,0,...)^T + new_l = [[0]*len(l) for x in range(len(l))] + terminal = [] + for i in range(len(l)): + d = sum(l[i]) + if d == 0: terminal.append(i) + for j in range(len(l)): + new_l[j][i] = -Fraction(l[i][j], 1 if d == 0 else d) + if i == j: new_l[i][j] = 1 + new_l[i][j] + + for i in range(len(l)): new_l[i].append(Fraction(i == 0)) + return (new_l, terminal) + + +def gauss_elim(l): + for i in range(len(l)): # Column + for j in range(len(l)): # Row + if i == j: + if l[j][i] == 1: continue + div_row(l, j, l[j][i]) + else: + if l[j][i] == 0: continue + add_row(l, j, i, Fraction(-l[j][i], l[i][i])) + + +def gcd(a, b): + while b > 0: + a, b = b, a % b + return a + +def lcm(a, b): + return a * b / gcd(a, b) + + +def simplify(p): + denom = [x.denominator for x in p] + curr_lcm = denom[0] + for i in range(1, len(denom)): + curr_lcm = lcm(curr_lcm, denom[i]) + + for i in range(len(p)): + p[i] = p[i].numerator * curr_lcm / denom[i] + + p.append(curr_lcm) + + +def solution(l): + # L^n[i][j] = Probability of arriving at state j starting from state i in n steps + # Sum(L^n) from 0 to n = (I - L)^{-1}. + # Since we only want the first row, we can do some simplifications by + # row reducing with the transpose, and augment with the (1,0,0,0, ...)^T + l, terminal = process(l) + print(l) + gauss_elim(l) + + probs = [x[-1] for i,x in enumerate(l) if i in terminal] + simplify(probs) + return probs diff --git a/Google FooBar/elevatorVersion.py b/Google FooBar/elevatorVersion.py new file mode 100644 index 0000000..32034dd --- /dev/null +++ b/Google FooBar/elevatorVersion.py @@ -0,0 +1,14 @@ +def ver_val(s): + s = s.split(".") + length = len(s) + s += ['0']*(3-length) # Outer pad array right zeros. + s = ['0'*(3-len(x)) + x for x in s] # Inner pad string left zeros + s += [str(length)] # Take length into consideration, less is better. + return ''.join(s) + + +def solution(l): + d = dict() + for version in l: d[version] = ver_val(version) + l.sort(key=lambda x: d[x]) + return l diff --git a/Google FooBar/expandingNebula.py b/Google FooBar/expandingNebula.py new file mode 100644 index 0000000..ae9565c --- /dev/null +++ b/Google FooBar/expandingNebula.py @@ -0,0 +1,81 @@ +def gen_masks(h): + # Cache numbers with one bit. + ones = [1 << x for x in range(h*2)] + + trans = [] # AND masks for applying the transform. + init = int(("11"+"0"*(h-2))*2, 2) + for i in range(h-1): trans.append(init >> i) + + return (ones, trans) + + +def col(g, i): + return [x[i] for x in g] + + +def get_preimages(col, o, t, bound=None): + # Obtains the valid preimages. + valid = {} + branches = 0 + h = len(col) + 1 + + if bound == None: + for n in range(o[-1]*2): # All possible preimages. + if n in o: continue + for i,m in enumerate(t): + if col[i] != ((n & m) in o): break + else: + if n not in valid: valid[n] = 0 + valid[n] += 1 + # Dictionary not necessary for first run, but keep for consistentcy. + branches = sum(valid.values()) + else: + for b in bound.keys(): # Preimages bound by the last valid columns. + branches -= bound[b] + for x in range(1 << h): + n = x + b + for i,m in enumerate(t): + if col[i] != ((n & m) in o): break + else: + if n not in valid: valid[n] = 0 + # Keep track of what to remove later. Carrythrough. + valid[n] += bound[b] + branches += bound[b] + + new_bound = dict() + # AND mask for extracting second column. (Last 4 bits) + mask = int("0"*h+"1"*h, 2) + for n in valid: + a = (n & mask) << h + if a not in new_bound: new_bound[a] = 0 + new_bound[a] += valid[n] + + return (branches, new_bound) + + +def solution(g): + o, t = gen_masks(len(g)+1) + + count, bound = get_preimages(col(g, 0), o, t) + for i in range(1, len(g[0])): + c, bound = get_preimages(col(g, i), o, t, bound) + count += c + + print("Count", count) + return count + + +solution([[True, False, True], [False, True, False], [True, False, True]]) +solution([ + [True, False, True, False, False, True, True, True], + [True, False, True, False, False, False, True, False], + [True, True, True, False, False, False, True, False], + [True, False, True, False, False, False, True, False], + [True, False, True, False, False, True, True, True]]) +solution([[True, True, False, True, False, True, False, True, True, False], [True, True, False, False, False, False, True, True, True, False], [True, True, False, False, False, False, False, False, False, True], [False, True, False, False, False, False, True, True, False, False]]) +solution([ + [True, False, True, False, False, True, True, True, True, False, True, False, False, True, True, True], + [True, False, True, False, False, False, True, False, True, False, True, False, False, False, True, False], + [True, True, True, False, False, False, True, False, True, True, True, False, False, False, True, False], + [True, False, True, False, False, False, True, False, True, False, True, False, False, False, True, False], + [True, False, True, False, False, True, True, True, True, False, True, False, False, True, True, True]]) diff --git a/Google FooBar/freeBunnies.py b/Google FooBar/freeBunnies.py new file mode 100644 index 0000000..1ce6117 --- /dev/null +++ b/Google FooBar/freeBunnies.py @@ -0,0 +1,10 @@ +from itertools import combinations + +def solution(buns, reqs): + l = [ [] for x in range(buns) ] + c = combinations(range(buns), buns-reqs+1) + for i,t in enumerate(c): + for n in t: l[n].append(i) + + return l + diff --git a/Google FooBar/gunFight.py b/Google FooBar/gunFight.py new file mode 100644 index 0000000..f48309f --- /dev/null +++ b/Google FooBar/gunFight.py @@ -0,0 +1,108 @@ +class Vector: + def __init__(self, x, y): + self.x = x + self.y = y + + def __add__(self, v2): + return Vector(self.x + v2.x, self.y + v2.y) + + def __sub__(self, v2): + return Vector(self.x - v2.x, self.y - v2.y) + + def __mul__(self, v2): + if isinstance(v2, int): + return Vector(self.x * v2, self.y * v2) + else: + return Vector(self.x * v2.x, self.y * v2.y) + + __rmul__ = __mul__ + + def __str__(self): + return "{" + str(self.x) + ", " + str(self.y) + "}" + + def __repr__(self): + return "{" + str(self.x) + ", " + str(self.y) + "}" + + def mag(self): + # Magnitude squared. For our scenario, this is + # irrelvant, since sqrt is a monotonic function. + # Caches magnitude, need to update manually. + self.magnitude = self.x**2 + self.y**2 + return self + + def whole(self): + # Gets reduced form of vector for parallel comparison. + # Caches, need to update manually + if self.x == 0 and self.y == 0: + self.whole = (0,0) + elif self.x == 0: + self.whole = (0, sgn(self.y)) + elif self.y == 0: + self.whole = (sgn(self.x), 0) + else: + d = gcd(abs(self.x), abs(self.y)) + self.whole = (self.x/d, self.y/d) + return self + + +def abs(a): + return a if a > 0 else -a + + +def sgn(a): + return -1 if a < 0 else 1 + + +def gcd(a, b): + while b > 0: + a, b = b, a % b + return a + + +def gen_spiral(w): + x = [] + i, j, dc = 0, 0, [0, -1] + for z in range((2*w + 1)**2): + x.append((i, j)) + if i == j or (i < 0 and i == -j) or (i > 0 and i == 1 - j): + dc = [-dc[1], dc[0]] + i, j = i+dc[0], j+dc[1] + return x + + +def solution(dim, pos_y, pos_g, dist): + dim, pos_y, pos_g = Vector(*dim), Vector(*pos_y), Vector(*pos_g) + + # Vectors of all mirrors of you and guard. + count = 0 + all_you_set, all_guard_set = set(), set() + + w = (dist / min([dim.x, dim.y])) + 1 + dist = dist**2 + spiral = gen_spiral(w) + + hits = set() + + off_y, off_g = (-2*pos_y + dim), (-2*pos_g + dim) + for c in spiral: + base = Vector(*c) * dim + + # Handle mirror reflections every other. + decide = Vector(int(c[0] % 2 == 1), int(c[1] % 2 == 1)) + + mir_y = (base + decide * off_y).mag().whole() + mir_g = ((base + pos_g + decide * off_g) - pos_y).mag().whole() + + # Check that new vectors don't already exist. + y_len, g_len = len(all_you_set), len(all_guard_set) + all_you_set.add(mir_y.whole) + all_guard_set.add(mir_g.whole) + uniq_y = y_len != len(all_you_set) + uniq_g = g_len != len(all_guard_set) + + # Since we spiral out, any guard vector in set of you vectors must + # hit you first. + if mir_g.whole in all_you_set: continue + if mir_g.magnitude <= dist and uniq_g: count += 1 + + return count diff --git a/Google FooBar/luckyTriple.py b/Google FooBar/luckyTriple.py new file mode 100644 index 0000000..f647420 --- /dev/null +++ b/Google FooBar/luckyTriple.py @@ -0,0 +1,10 @@ +def solution(l): + divs = [0]*len(l) + tups = 0 + for i in range(len(l)): + for j in range(i): + if l[i] % l[j] == 0: + divs[i] += 1 + tups += divs[j] + + return tups diff --git a/Google FooBar/primeGen.py b/Google FooBar/primeGen.py new file mode 100644 index 0000000..534f196 --- /dev/null +++ b/Google FooBar/primeGen.py @@ -0,0 +1,24 @@ +s = "23" +i = 4 +while True: + prime = True + for j in range(2, i): + if i/j == i//j: + prime = False + + if prime: + s += str(i) + print(i) + if len(s) >= 10005: break + i += 1 + + +final = "" +for i in range(len(s)//60): + final += "\"" + s[i*60:(i+1)*60] + "\"\\\n" + +final += "\"" + s[60*(len(s)//60):] + "\"\\\n" + +f = open("primes.txt","w") +f.write(final) +f.close() \ No newline at end of file diff --git a/Google FooBar/primes.txt b/Google FooBar/primes.txt new file mode 100644 index 0000000..af722c9 --- /dev/null +++ b/Google FooBar/primes.txt @@ -0,0 +1,167 @@ +"235711131719232931374143475359616771737983899710110310710911"\ +"312713113713914915115716316717317918119119319719921122322722"\ +"923323924125125726326927127728128329330731131331733133734734"\ +"935335936737337938338939740140941942143143343944344945746146"\ +"346747948749149950350952152354154755756356957157758759359960"\ +"160761361761963164164364765365966167367768369170170971972773"\ +"373974375175776176977378779780981182182382782983985385785986"\ +"387788188388790791191992993794194795396797197798399199710091"\ +"013101910211031103310391049105110611063106910871091109310971"\ +"103110911171123112911511153116311711181118711931201121312171"\ +"223122912311237124912591277127912831289129112971301130313071"\ +"319132113271361136713731381139914091423142714291433143914471"\ +"451145314591471148114831487148914931499151115231531154315491"\ +"553155915671571157915831597160116071609161316191621162716371"\ +"657166316671669169316971699170917211723173317411747175317591"\ +"777178317871789180118111823183118471861186718711873187718791"\ +"889190119071913193119331949195119731979198719931997199920032"\ +"011201720272029203920532063206920812083208720892099211121132"\ +"129213121372141214321532161217922032207221322212237223922432"\ +"251226722692273228122872293229723092311233323392341234723512"\ +"357237123772381238323892393239924112417242324372441244724592"\ +"467247324772503252125312539254325492551255725792591259326092"\ +"617262126332647265726592663267126772683268726892693269927072"\ +"711271327192729273127412749275327672777278927912797280128032"\ +"819283328372843285128572861287928872897290329092917292729392"\ +"953295729632969297129993001301130193023303730413049306130673"\ +"079308330893109311931213137316331673169318131873191320332093"\ +"217322132293251325332573259327132993301330733133319332333293"\ +"331334333473359336133713373338933913407341334333449345734613"\ +"463346734693491349935113517352735293533353935413547355735593"\ +"571358135833593360736133617362336313637364336593671367336773"\ +"691369737013709371937273733373937613767376937793793379738033"\ +"821382338333847385138533863387738813889390739113917391939233"\ +"929393139433947396739894001400340074013401940214027404940514"\ +"057407340794091409340994111412741294133413941534157415941774"\ +"201421142174219422942314241424342534259426142714273428342894"\ +"297432743374339434943574363437343914397440944214423444144474"\ +"451445744634481448344934507451345174519452345474549456145674"\ +"583459145974603462146374639464346494651465746634673467946914"\ +"703472147234729473347514759478347874789479347994801481348174"\ +"831486148714877488949034909491949314933493749434951495749674"\ +"969497349874993499950035009501150215023503950515059507750815"\ +"087509951015107511351195147515351675171517951895197520952275"\ +"231523352375261527352795281529753035309532353335347535153815"\ +"387539353995407541354175419543154375441544354495471547754795"\ +"483550155035507551955215527553155575563556955735581559156235"\ +"639564156475651565356575659566956835689569357015711571757375"\ +"741574357495779578357915801580758135821582758395843584958515"\ +"857586158675869587958815897590359235927593959535981598760076"\ +"011602960376043604760536067607360796089609161016113612161316"\ +"133614361516163617361976199620362116217622162296247625762636"\ +"269627162776287629963016311631763236329633763436353635963616"\ +"367637363796389639764216427644964516469647364816491652165296"\ +"547655165536563656965716577658165996607661966376653665966616"\ +"673667966896691670167036709671967336737676167636779678167916"\ +"793680368236827682968336841685768636869687168836899690769116"\ +"917694769496959696169676971697769836991699770017013701970277"\ +"039704370577069707971037109712171277129715171597177718771937"\ +"207721172137219722972377243724772537283729773077309732173317"\ +"333734973517369739374117417743374517457745974777481748774897"\ +"499750775177523752975377541754775497559756175737577758375897"\ +"591760376077621763976437649766976737681768776917699770377177"\ +"723772777417753775777597789779378177823782978417853786778737"\ +"877787978837901790779197927793379377949795179637993800980118"\ +"017803980538059806980818087808980938101811181178123814781618"\ +"167817181798191820982198221823182338237824382638269827382878"\ +"291829382978311831783298353836383698377838783898419842384298"\ +"431844384478461846785018513852185278537853985438563857385818"\ +"597859986098623862786298641864786638669867786818689869386998"\ +"707871387198731873787418747875387618779878388038807881988218"\ +"831883788398849886188638867888788938923892989338941895189638"\ +"969897189999001900790119013902990419043904990599067909191039"\ +"109912791339137915191579161917391819187919992039209922192279"\ +"239924192579277928192839293931193199323933793419343934993719"\ +"377939193979403941394199421943194339437943994619463946794739"\ +"479949194979511952195339539954795519587960196139619962396299"\ +"631964396499661967796799689969797199721973397399743974997679"\ +"769978197879791980398119817982998339839985198579859987198839"\ +"887990199079923992999319941994999679973100071000910037100391"\ +"006110067100691007910091100931009910103101111013310139101411"\ +"015110159101631016910177101811019310211102231024310247102531"\ +"025910267102711027310289103011030310313103211033110333103371"\ +"034310357103691039110399104271042910433104531045710459104631"\ +"047710487104991050110513105291053110559105671058910597106011"\ +"060710613106271063110639106511065710663106671068710691107091"\ +"071110723107291073310739107531077110781107891079910831108371"\ +"084710853108591086110867108831088910891109031090910937109391"\ +"094910957109731097910987109931100311027110471105711059110691"\ +"107111083110871109311113111171111911131111491115911161111711"\ +"117311177111971121311239112431125111257112611127311279112871"\ +"129911311113171132111329113511135311369113831139311399114111"\ +"142311437114431144711467114711148311489114911149711503115191"\ +"152711549115511157911587115931159711617116211163311657116771"\ +"168111689116991170111717117191173111743117771177911783117891"\ +"180111807118131182111827118311183311839118631186711887118971"\ +"190311909119231192711933119391194111953119591196911971119811"\ +"198712007120111203712041120431204912071120731209712101121071"\ +"210912113121191214312149121571216112163121971220312211122271"\ +"223912241122511225312263122691227712281122891230112323123291"\ +"234312347123731237712379123911240112409124131242112433124371"\ +"245112457124731247912487124911249712503125111251712527125391"\ +"254112547125531256912577125831258912601126111261312619126371"\ +"264112647126531265912671126891269712703127131272112739127431"\ +"275712763127811279112799128091282112823128291284112853128891"\ +"289312899129071291112917129191292312941129531295912967129731"\ +"297912983130011300313007130091303313037130431304913063130931"\ +"309913103131091312113127131471315113159131631317113177131831"\ +"318713217132191322913241132491325913267132911329713309133131"\ +"332713331133371333913367133811339713399134111341713421134411"\ +"345113457134631346913477134871349913513135231353713553135671"\ +"357713591135971361313619136271363313649136691367913681136871"\ +"369113693136971370913711137211372313729137511375713759137631"\ +"378113789137991380713829138311384113859138731387713879138831"\ +"390113903139071391313921139311393313963139671399713999140091"\ +"401114029140331405114057140711408114083140871410714143141491"\ +"415314159141731417714197142071422114243142491425114281142931"\ +"430314321143231432714341143471436914387143891440114407144111"\ +"441914423144311443714447144491446114479144891450314519145331"\ +"453714543145491455114557145611456314591145931462114627146291"\ +"463314639146531465714669146831469914713147171472314731147371"\ +"474114747147531475914767147711477914783147971481314821148271"\ +"483114843148511486714869148791488714891148971492314929149391"\ +"494714951149571496914983150131501715031150531506115073150771"\ +"508315091151011510715121151311513715139151491516115173151871"\ +"519315199152171522715233152411525915263152691527115277152871"\ +"528915299153071531315319153291533115349153591536115373153771"\ +"538315391154011541315427154391544315451154611546715473154931"\ +"549715511155271554115551155591556915581155831560115607156191"\ +"562915641156431564715649156611566715671156791568315727157311"\ +"573315737157391574915761157671577315787157911579715803158091"\ +"581715823158591587715881158871588915901159071591315919159231"\ +"593715959159711597315991160011600716033160571606116063160671"\ +"606916073160871609116097161031611116127161391614116183161871"\ +"618916193162171622316229162311624916253162671627316301163191"\ +"633316339163491636116363163691638116411164171642116427164331"\ +"644716451164531647716481164871649316519165291654716553165611"\ +"656716573166031660716619166311663316649166511665716661166731"\ +"669116693166991670316729167411674716759167631678716811168231"\ +"682916831168431687116879168831688916901169031692116927169311"\ +"693716943169631697916981169871699317011170211702717029170331"\ +"704117047170531707717093170991710717117171231713717159171671"\ +"718317189171911720317207172091723117239172571729117293172991"\ +"731717321173271733317341173511735917377173831738717389173931"\ +"740117417174191743117443174491746717471174771748317489174911"\ +"749717509175191753917551175691757317579175811759717599176091"\ +"762317627176571765917669176811768317707177131772917737177471"\ +"774917761177831778917791178071782717837178391785117863178811"\ +"789117903179091791117921179231792917939179571795917971179771"\ +"798117987179891801318041180431804718049180591806118077180891"\ +"809718119181211812718131181331814318149181691818118191181991"\ +"821118217182231822918233182511825318257182691828718289183011"\ +"830718311183131832918341183531836718371183791839718401184131"\ +"842718433184391844318451184571846118481184931850318517185211"\ +"852318539185411855318583185871859318617186371866118671186791"\ +"869118701187131871918731187431874918757187731878718793187971"\ +"880318839188591886918899189111891318917189191894718959189731"\ +"897919001190091901319031190371905119069190731907919081190871"\ +"912119139191411915719163191811918319207192111921319219192311"\ +"923719249192591926719273192891930119309193191933319373193791"\ +"938119387193911940319417194211942319427194291943319441194471"\ +"945719463194691947119477194831948919501195071953119541195431"\ +"955319559195711957719583195971960319609196611968119687196971"\ +"969919709197171972719739197511975319759197631977719793198011"\ +"981319819198411984319853198611986719889198911991319919199271"\ +"993719949199611996319973199791999119993199972001120021200232"\ +"002920047200512006320071200892010120107201132011720123201292"\ +"0143201472014920161201732017720183202012021920231"\ diff --git a/Google FooBar/reid.py b/Google FooBar/reid.py new file mode 100644 index 0000000..62ef7c5 --- /dev/null +++ b/Google FooBar/reid.py @@ -0,0 +1,170 @@ +def solution(i): + primes = "235711131719232931374143475359616771737983899710110310710911"\ + "312713113713914915115716316717317918119119319719921122322722"\ + "923323924125125726326927127728128329330731131331733133734734"\ + "935335936737337938338939740140941942143143343944344945746146"\ + "346747948749149950350952152354154755756356957157758759359960"\ + "160761361761963164164364765365966167367768369170170971972773"\ + "373974375175776176977378779780981182182382782983985385785986"\ + "387788188388790791191992993794194795396797197798399199710091"\ + "013101910211031103310391049105110611063106910871091109310971"\ + "103110911171123112911511153116311711181118711931201121312171"\ + "223122912311237124912591277127912831289129112971301130313071"\ + "319132113271361136713731381139914091423142714291433143914471"\ + "451145314591471148114831487148914931499151115231531154315491"\ + "553155915671571157915831597160116071609161316191621162716371"\ + "657166316671669169316971699170917211723173317411747175317591"\ + "777178317871789180118111823183118471861186718711873187718791"\ + "889190119071913193119331949195119731979198719931997199920032"\ + "011201720272029203920532063206920812083208720892099211121132"\ + "129213121372141214321532161217922032207221322212237223922432"\ + "251226722692273228122872293229723092311233323392341234723512"\ + "357237123772381238323892393239924112417242324372441244724592"\ + "467247324772503252125312539254325492551255725792591259326092"\ + "617262126332647265726592663267126772683268726892693269927072"\ + "711271327192729273127412749275327672777278927912797280128032"\ + "819283328372843285128572861287928872897290329092917292729392"\ + "953295729632969297129993001301130193023303730413049306130673"\ + "079308330893109311931213137316331673169318131873191320332093"\ + "217322132293251325332573259327132993301330733133319332333293"\ + "331334333473359336133713373338933913407341334333449345734613"\ + "463346734693491349935113517352735293533353935413547355735593"\ + "571358135833593360736133617362336313637364336593671367336773"\ + "691369737013709371937273733373937613767376937793793379738033"\ + "821382338333847385138533863387738813889390739113917391939233"\ + "929393139433947396739894001400340074013401940214027404940514"\ + "057407340794091409340994111412741294133413941534157415941774"\ + "201421142174219422942314241424342534259426142714273428342894"\ + "297432743374339434943574363437343914397440944214423444144474"\ + "451445744634481448344934507451345174519452345474549456145674"\ + "583459145974603462146374639464346494651465746634673467946914"\ + "703472147234729473347514759478347874789479347994801481348174"\ + "831486148714877488949034909491949314933493749434951495749674"\ + "969497349874993499950035009501150215023503950515059507750815"\ + "087509951015107511351195147515351675171517951895197520952275"\ + "231523352375261527352795281529753035309532353335347535153815"\ + "387539353995407541354175419543154375441544354495471547754795"\ + "483550155035507551955215527553155575563556955735581559156235"\ + "639564156475651565356575659566956835689569357015711571757375"\ + "741574357495779578357915801580758135821582758395843584958515"\ + "857586158675869587958815897590359235927593959535981598760076"\ + "011602960376043604760536067607360796089609161016113612161316"\ + "133614361516163617361976199620362116217622162296247625762636"\ + "269627162776287629963016311631763236329633763436353635963616"\ + "367637363796389639764216427644964516469647364816491652165296"\ + "547655165536563656965716577658165996607661966376653665966616"\ + "673667966896691670167036709671967336737676167636779678167916"\ + "793680368236827682968336841685768636869687168836899690769116"\ + "917694769496959696169676971697769836991699770017013701970277"\ + "039704370577069707971037109712171277129715171597177718771937"\ + "207721172137219722972377243724772537283729773077309732173317"\ + "333734973517369739374117417743374517457745974777481748774897"\ + "499750775177523752975377541754775497559756175737577758375897"\ + "591760376077621763976437649766976737681768776917699770377177"\ + "723772777417753775777597789779378177823782978417853786778737"\ + "877787978837901790779197927793379377949795179637993800980118"\ + "017803980538059806980818087808980938101811181178123814781618"\ + "167817181798191820982198221823182338237824382638269827382878"\ + "291829382978311831783298353836383698377838783898419842384298"\ + "431844384478461846785018513852185278537853985438563857385818"\ + "597859986098623862786298641864786638669867786818689869386998"\ + "707871387198731873787418747875387618779878388038807881988218"\ + "831883788398849886188638867888788938923892989338941895189638"\ + "969897189999001900790119013902990419043904990599067909191039"\ + "109912791339137915191579161917391819187919992039209922192279"\ + "239924192579277928192839293931193199323933793419343934993719"\ + "377939193979403941394199421943194339437943994619463946794739"\ + "479949194979511952195339539954795519587960196139619962396299"\ + "631964396499661967796799689969797199721973397399743974997679"\ + "769978197879791980398119817982998339839985198579859987198839"\ + "887990199079923992999319941994999679973100071000910037100391"\ + "006110067100691007910091100931009910103101111013310139101411"\ + "015110159101631016910177101811019310211102231024310247102531"\ + "025910267102711027310289103011030310313103211033110333103371"\ + "034310357103691039110399104271042910433104531045710459104631"\ + "047710487104991050110513105291053110559105671058910597106011"\ + "060710613106271063110639106511065710663106671068710691107091"\ + "071110723107291073310739107531077110781107891079910831108371"\ + "084710853108591086110867108831088910891109031090910937109391"\ + "094910957109731097910987109931100311027110471105711059110691"\ + "107111083110871109311113111171111911131111491115911161111711"\ + "117311177111971121311239112431125111257112611127311279112871"\ + "129911311113171132111329113511135311369113831139311399114111"\ + "142311437114431144711467114711148311489114911149711503115191"\ + "152711549115511157911587115931159711617116211163311657116771"\ + "168111689116991170111717117191173111743117771177911783117891"\ + "180111807118131182111827118311183311839118631186711887118971"\ + "190311909119231192711933119391194111953119591196911971119811"\ + "198712007120111203712041120431204912071120731209712101121071"\ + "210912113121191214312149121571216112163121971220312211122271"\ + "223912241122511225312263122691227712281122891230112323123291"\ + "234312347123731237712379123911240112409124131242112433124371"\ + "245112457124731247912487124911249712503125111251712527125391"\ + "254112547125531256912577125831258912601126111261312619126371"\ + "264112647126531265912671126891269712703127131272112739127431"\ + "275712763127811279112799128091282112823128291284112853128891"\ + "289312899129071291112917129191292312941129531295912967129731"\ + "297912983130011300313007130091303313037130431304913063130931"\ + "309913103131091312113127131471315113159131631317113177131831"\ + "318713217132191322913241132491325913267132911329713309133131"\ + "332713331133371333913367133811339713399134111341713421134411"\ + "345113457134631346913477134871349913513135231353713553135671"\ + "357713591135971361313619136271363313649136691367913681136871"\ + "369113693136971370913711137211372313729137511375713759137631"\ + "378113789137991380713829138311384113859138731387713879138831"\ + "390113903139071391313921139311393313963139671399713999140091"\ + "401114029140331405114057140711408114083140871410714143141491"\ + "415314159141731417714197142071422114243142491425114281142931"\ + "430314321143231432714341143471436914387143891440114407144111"\ + "441914423144311443714447144491446114479144891450314519145331"\ + "453714543145491455114557145611456314591145931462114627146291"\ + "463314639146531465714669146831469914713147171472314731147371"\ + "474114747147531475914767147711477914783147971481314821148271"\ + "483114843148511486714869148791488714891148971492314929149391"\ + "494714951149571496914983150131501715031150531506115073150771"\ + "508315091151011510715121151311513715139151491516115173151871"\ + "519315199152171522715233152411525915263152691527115277152871"\ + "528915299153071531315319153291533115349153591536115373153771"\ + "538315391154011541315427154391544315451154611546715473154931"\ + "549715511155271554115551155591556915581155831560115607156191"\ + "562915641156431564715649156611566715671156791568315727157311"\ + "573315737157391574915761157671577315787157911579715803158091"\ + "581715823158591587715881158871588915901159071591315919159231"\ + "593715959159711597315991160011600716033160571606116063160671"\ + "606916073160871609116097161031611116127161391614116183161871"\ + "618916193162171622316229162311624916253162671627316301163191"\ + "633316339163491636116363163691638116411164171642116427164331"\ + "644716451164531647716481164871649316519165291654716553165611"\ + "656716573166031660716619166311663316649166511665716661166731"\ + "669116693166991670316729167411674716759167631678716811168231"\ + "682916831168431687116879168831688916901169031692116927169311"\ + "693716943169631697916981169871699317011170211702717029170331"\ + "704117047170531707717093170991710717117171231713717159171671"\ + "718317189171911720317207172091723117239172571729117293172991"\ + "731717321173271733317341173511735917377173831738717389173931"\ + "740117417174191743117443174491746717471174771748317489174911"\ + "749717509175191753917551175691757317579175811759717599176091"\ + "762317627176571765917669176811768317707177131772917737177471"\ + "774917761177831778917791178071782717837178391785117863178811"\ + "789117903179091791117921179231792917939179571795917971179771"\ + "798117987179891801318041180431804718049180591806118077180891"\ + "809718119181211812718131181331814318149181691818118191181991"\ + "821118217182231822918233182511825318257182691828718289183011"\ + "830718311183131832918341183531836718371183791839718401184131"\ + "842718433184391844318451184571846118481184931850318517185211"\ + "852318539185411855318583185871859318617186371866118671186791"\ + "869118701187131871918731187431874918757187731878718793187971"\ + "880318839188591886918899189111891318917189191894718959189731"\ + "897919001190091901319031190371905119069190731907919081190871"\ + "912119139191411915719163191811918319207192111921319219192311"\ + "923719249192591926719273192891930119309193191933319373193791"\ + "938119387193911940319417194211942319427194291943319441194471"\ + "945719463194691947119477194831948919501195071953119541195431"\ + "955319559195711957719583195971960319609196611968119687196971"\ + "969919709197171972719739197511975319759197631977719793198011"\ + "981319819198411984319853198611986719889198911991319919199271"\ + "993719949199611996319973199791999119993199972001120021200232"\ + "002920047200512006320071200892010120107201132011720123201292"\ + "0143201472014920161201732017720183202012021920231"\ + + return primes[i:i+5] \ No newline at end of file diff --git a/Google FooBar/setCounting.txt b/Google FooBar/setCounting.txt new file mode 100644 index 0000000..a9ed5d4 --- /dev/null +++ b/Google FooBar/setCounting.txt @@ -0,0 +1,22 @@ +Distributing keys to A people, where +B people are required to unlock, requires: +A choose B-1 keys. + +We can distribute following possible combinations: + +Ex: 5 people, 2 required: 5 C 3 = 10 + +0123 +012 4 +01 34 +0 234 + 1234 + +We obtain A choose B-1, from seeing that we require +the combinations to be generated from A-B+1. + +This is obtained from A-G+1 = B, +People - GroupSize + 1 = Required, +G = A-B+1 + +A choose A-B+1 = A choose B-1