Skip to content

Instantly share code, notes, and snippets.

bboe /
Last active April 14, 2022 09:54
Set retention on slack conversations with deleted users to 1 day.
#!/usr/bin/env python
"""Set retention on slack conversations to 400 days.
Usage: ./ [--perform] --token SLACK_TOKEN
The `--perform` flag is necessary to actually perform the action.
Due to the fact that `conversations.setToken` is not part of the public API
the slack legacy token concept will not work. To obtain the API token,
open up slack in the browser and observe networking traffic while performing
bboe / parse_email_list.js
Last active January 26, 2022 23:24
Javascript email list parser with display name
View parse_email_list.js
function display_name(text) {
/* Remove all quotes
Remove whitespace, brackets, and commas from the ends. */
return text.replace(/(^[\s,>]+)|"|([\s,<]+$)/g, '');
function emails(addr_list) {
/* Regex source:
bboe / validation.rb
Last active July 23, 2021 18:45
ActiveModel Validation With Whitespace
View validation.rb
#!/usr/bin/env ruby
require 'active_model'
require 'minitest/autorun'
class Simple
include ActiveModel::Model
validates :name, allow_blank: true, allow_nil: true, length: { is: 2 }
attr_accessor :name
bboe / domains.txt
Created June 16, 2021 23:03
Test time to DNS query and connect to various domains
View domains.txt
bboe /
Last active June 7, 2021 06:26
Python Reddit API Comment Loop Test
#!/usr/bin/env python3
import logging
import sys
import time
import praw
def configure_logging():
logger = logging.getLogger("praw")
bboe / NOTES.txt
Last active February 17, 2021 00:24
BBoe's Updates to "How To Make A reddit Bot — Part One"
View NOTES.txt
I'm Bryce (/u/bboe) Author of PRAW
/u/busterroni's Submission:
/u/busterroni's Part 1:
bboe /
Created June 16, 2013 19:02
Saves all the available comments and submissions for a given user.
#!/usr/bin/env python
import cPickle
import praw
import sys
PERIODS = ['all', 'year', 'month', 'week', 'day', 'hour']
PERIOD_VIEWS = ['controversial', 'top']
VIEWS = [{'sort': x, 't': y} for x in PERIOD_VIEWS for y in PERIODS]
VIEWS.insert(0, {'sort': 'new'})
bboe / bits.txt
Last active December 27, 2017 17:04
Level XM17
View bits.txt
010000 1
010010 1
001010 4
110010 0
100010 4
100010 4
110101 3
010011 1
010110 1
001000 2
bboe / 01_sequential.rb
Last active October 11, 2017 18:50
Ruby Simple TCP Echo Servers
View 01_sequential.rb
#!/usr/bin/env ruby
require './common.rb'
require 'socket'
def main
server = server_socket('', 1024)
loop do
bboe /
Created June 5, 2015 05:49
Create permanent reddit oauth tokens
#!/usr/bin/env python
"""Script to generate permenant OAuth tokens for the desired reddit scope."""
from __future__ import print_function
import os
import praw
import sys
from pprint import pprint