python post_count_bot.py
Exports data to post_counts.csv
, and overwrites the file every time you make a post on Reddit.
#!/usr/bin/env ruby | |
require 'english' | |
require 'rubocop' | |
ADDED_OR_MODIFIED = /A|AM|^M/.freeze | |
changed_files = `git status --porcelain`.split(/\n/). | |
select { |file_name_with_status| | |
file_name_with_status =~ ADDED_OR_MODIFIED |
# frozen_string_literal: true | |
module Devise | |
# Failure application that will be called every time :warden is thrown from | |
# any strategy or hook. This application overrides the default Devise | |
# failure application in order to render messages as JSON. | |
class ApiFailureApp < Devise::FailureApp | |
def respond | |
json_api_error_response | |
end |
import sys | |
import traceback | |
import datetime | |
import praw | |
BOT_USERNAME = 'BOT_USERNAME' | |
BOT_PASSWORD = 'BOT_PASSWORD' | |
BOT_CLIENT_ID = 'BOT_CLIENT_ID' | |
BOT_CLIENT_SECRET = 'BOT_CLIENT_SECRET' |
from bs4 import BeautifulSoup | |
import csv | |
import datetime | |
import praw | |
import requests | |
import traceback | |
import sys | |
BOT_USERNAME = 'BOT_USERNAME' |
import datetime | |
import praw | |
import traceback | |
import sys | |
BOT_USERNAME = 'BOT_USERNAME' | |
BOT_PASSWORD = 'BOT_PASSWORD' | |
BOT_CLIENT_ID = 'BOT_CLIENT_ID' | |
BOT_CLIENT_SECRET = 'BOT_CLIENT_SECRET' |
import praw | |
SUBREDDIT = 'test' | |
REPLY_USERNAME = 'AlternisBot' | |
KEYWORDS = ['these', 'words', 'trigger', 'a', 'reply'] | |
BLACKLISTED_KEYWORDS = ['only', 'if', 'these', 'are', 'absent'] | |
reddit = praw.Reddit(username='REDDIT_USERNAME', | |
password='REDDIT_PASSWORD', | |
client_id='REDDIT_CLIENT_ID', |
import praw | |
from datetime import datetime | |
class Bot: | |
REDDIT = praw.Reddit(username='REDDIT_USERNAME', | |
password='REDDIT_PASSWORD', | |
client_id='REDDIT_CLIENT_ID', | |
client_secret='REDDIT_CLIENT_SECRET', |
# Your task is to find the minimum SQUARE area in which you can place two identical rectangles. The sides of the rectangles should be parallel to the sides of the square. | |
# You are given two identical rectangles with side lengths a and b with 1 <= a, b <= 100. | |
# Find the square with minimum area that contains both given rectangles. Rectangles can be rotated (both or just one) and moved, but the sides of the rectangles should be parallel to the sides of the desired square. | |
def minimal_square(a, b): | |
# This solution abuses the fact that we can multiply by True/False: | |
# For instance, 1 * True = 1 and 1 * False = 0 | |
# | |
# A step further: |
# frozen_string_literal: true | |
require 'platform-api' | |
# Adapted from GitLab | |
# | |
# Docs: https://docs.gitlab.com/ee/administration/operations/sidekiq_memory_killer.html | |
# Source: https://gitlab.com/gitlab-org/gitlab-foss/-/blob/master/lib/gitlab/sidekiq_daemon/memory_killer.rb | |
class Sidekiq::Middleware::MemoryKiller | |
# Default the RSS limit to 0, meaning the MemoryKiller is disabled (kilobytes) |