python post_count_bot.py
Exports data to post_counts.csv
, and overwrites the file every time you make a post on Reddit.
# Rails | |
alias be="bundle exec" | |
alias ber="bundle exec rails" | |
# git | |
alias gcm="git commit -m" | |
alias gp="git push" | |
alias gst="git status" | |
alias gco="git checkout" |
class Assembler: | |
def __init__(self, program): | |
self.program = program | |
self.registers = {} | |
self.program_counter = 0 | |
def run(self): | |
while self.program_counter < len(self.program): | |
fn_name, *args = self.program[self.program_counter].split(" ") | |
fn = getattr(self, fn_name) |
# frozen_string_literal: true | |
FactoryBot.define do | |
factory :export do | |
skip_create | |
initialize_with do | |
new(attributes, type) | |
end | |
transient do |
# 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) |
# 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: |
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', |
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 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' |
from bs4 import BeautifulSoup | |
import csv | |
import datetime | |
import praw | |
import requests | |
import traceback | |
import sys | |
BOT_USERNAME = 'BOT_USERNAME' |