Skip to content

Instantly share code, notes, and snippets.

View BlaneyXYZ's full-sized avatar
🙏
Flex

Nathan Blaney BlaneyXYZ

🙏
Flex
View GitHub Profile
@blha303
blha303 / compliment.b303.me.py
Last active June 25, 2021 04:41
Gets random comment from /r/gonewild, since they're pretty much all compliments. http://compliment.b303.me Warning: May contain sexual content
#!/usr/bin/env python3
import requests
from flask import *
import random
from apscheduler.schedulers.background import BackgroundScheduler
app = Flask(__name__)
scheduler = BackgroundScheduler()
url = "https://reddit.com/r/gonewild/comments.json?limit=200"
@blha303
blha303 / cast.py
Last active October 28, 2015 02:34
Easy mp4 playback for chromecasts from python. no google chrome needed. for people without RAM. Pausing does not currently work for some reason.
#!/usr/bin/env python
# requires pychromecast and probably python 2.7, sorry
import pychromecast
import argparse
def play_video(url, cast):
if cast.media_controller.status.player_state == "PAUSED" or cast.media_controller.status.content_id == url:
cast.media_controller.play()
else:
@blha303
blha303 / netflix.py
Last active August 29, 2015 14:18
A python function to get netflix movie info and parse out all relevant data, returning it in a tuple as stated in the docstring
"""
Example usage:
>>> netflix("60024942")
(u'Catch Me If You Can', u'2002', u'Thu Jan 09 08:00:00 UTC 2003', u'M', u'140 minutes', u'http://cdn2.nflximg.net/images/0432/12050432.jpg', u'An FBI agent makes it his mission to put cunning con man Frank Abagnale Jr. behind bars. But Frank not only eludes capture, he revels in the pursuit.', {u'director': u'Steven Spielberg', u'genre': u'Dramas', u'language': u'English', u'starring': u'Leonardo DiCaprio, Tom Hanks'})
ID could be obtained through trivial URL parsing using any stdlib library.
Here, i'll do an example:
from urlparse import urlparse, parse_qs # urllib.parse in python 3
package com.goebl.david;
import junit.framework.TestCase;
import org.json.JSONObject;
public class TestWebb_LocalStackoverflow23678518 extends TestCase {
public void testPost() throws Exception {
JSONObject register = new JSONObject();