Skip to content

Instantly share code, notes, and snippets.

View Roysten's full-sized avatar

Roy van der Vegt Roysten

  • The Solar System
View GitHub Profile
@Roysten
Roysten / spotdump.js
Last active March 14, 2016 18:39
This javascript function scrapes the spotify web UI and converts your playlist to plain text for easy archiving. Usage: copy the script in the console of your browser. Next, type `scrape()`. Make sure to scroll to the bottom of your playlist so the entire list is loaded. Try changing the index of the iframe if the script doesn't work right away.
function scrape() {
/* Uncomment one of the lines below */
//var iframe = document.getElementsByTagName("iframe")[1].contentDocument;
var iframe = document.getElementsByTagName("iframe")[2].contentDocument;
var artists = iframe.getElementsByClassName("tl-cell tl-artists");
var titles = iframe.getElementsByClassName("tl-cell tl-name");
for(var i = 0; i < titles.length; ++i) {
console.log(artists[i].innerText + " -- " + titles[i].innerText);
}
}
@Roysten
Roysten / m1cha.xml
Last active September 18, 2015 11:44
Local manifest to build CM12.1
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<!-- remotes -->
<remote name="github-m1cha"
fetch="git://github.com"
revision="android-5.1.1" />
<!--Remove this project because it doesn't compile https://github.com/CyanogenMod/android/commit/ddd855bbe76f07dfee1d25baf2e8eea4cef492f2 -->
<remove-project name="platform/frameworks/testing" />
@Roysten
Roysten / main.rs
Created September 3, 2015 08:20
Munten
use std::collections::HashMap;
fn main() {
let mut coins = HashMap::new();
coins.insert(200, 4);
coins.insert(100, 2);
coins.insert(50, 8);
coins.insert(20, 1);
coins.insert(10, 4);
coins.insert(5, 3);
@Roysten
Roysten / main.rs
Created September 3, 2015 07:19
Zombie Apocalypse Tweakers
const DAYTIME: [usize; 2] = [8, 22];
fn main() {
let mut people = 7_000_000_000isize;
let mut zombies = 1;
let mut hour = 0;
while people > 0 {
let hour_of_day = hour % 24;