This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
USAGE: | |
You need xvfb, python(2), praw and CutyCapt (see below). Simply run this as | |
a normal python script: `python local_reddit.py` | |
CUSTOMIZATION: | |
* change number of screencaps in main() (10 by deafault) | |
* change queried subreddits in main() | |
(query multiple reddits: "askreddit+writingprompts") | |
* get_top() submissions from day/week instead of hot ones (get_hot()) | |
TIME: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# WHAT? | |
# this is a modified version of tst's generate bot for | |
# text2quote (i.e. text on a fancy background) generation. | |
# it is stripped in that the imgur/reddit references are | |
# removed and it is called in the same way as my own text2quote | |
# module (so it is interchangable). | |
# UNTESTED AND HACKY, USE AT YOUR OWN RISK. | |
import os | |
import textwrap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Program to find occurrences of one audio clip inside another audio clip. | |
# you need to youtube-dl the video with id mPdcedZ9GxE for the example | |
# WARNING! example requires 3GB of free RAM | |
from moviepy.editor import * | |
from numpy import * | |
from scipy.signal import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unit ujff2; | |
{$mode objfpc}{$H+} | |
interface | |
uses | |
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, | |
ExtCtrls, Menus, Buttons, StdCtrls, IniFiles; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# import matplotlib.pyplot as plt; plt.rcdefaults() | |
import numpy as np | |
import matplotlib.pyplot as plt | |
data = [ | |
['India', 16], | |
['United States', 56], | |
['Bangladesh', 57], | |
['France', 71], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
data = [ | |
['not Trump', 128-91], | |
['Trump', 91], | |
] | |
data_x = [d[0] for d in data][::-1] | |
data_y = [d[1] for d in data] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import numpy as np | |
num_rows, num_cols, min_ingr, max_size = [int(x) for x in input().split(' ')] | |
pizza = np.array([[int(x == 'T') for x in input()] for i in range(num_rows)]) | |
output = [] | |
dead = np.zeros_like(pizza).astype(int) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# modified from https://gist.github.com/rasher/4208507 (python 2) | |
import sys | |
from datetime import datetime | |
from praw import Reddit | |
from collections import defaultdict | |
r = Reddit(user_agent='flairstats/0.1 by <YOUR USERNAME>', | |
client_id='<GET THESE AS DESCRIBED HERE:', client_secret='https://praw.readthedocs.io/en/latest/getting_started/quick_start.html>', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@client.event | |
async def on_ready(): | |
while True: | |
await asyncio.sleep(24*60*60) | |
print('Another day has passed!') | |
@client.event | |
async def on_message(message): | |
if message.author == client.user: return # Do not reply to self | |
await message.channel.send('I can still respond to your messages!') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import time | |
async def say_after(delay, what): | |
await asyncio.sleep(delay) | |
print(what) | |
async def use_await(): | |
await say_after(3, 'world') | |
await say_after(2, 'hello') |
OlderNewer