Skip to content

Instantly share code, notes, and snippets.

@hundredwatt
hundredwatt / initializer.rb
Created February 8, 2015 20:42
Apply rails/rails#18846 for Delayed Job workers
Delayed::Worker.lifecycle.before :execute do
require 'active_record/relation/warn_on_result_set_size'
ActiveRecord::Base.warn_on_result_set_size = 1001
ActiveRecord::Base.logger = Rails.logger
ActiveRecord::Base.logger.level = Logger::WARN
end
'use strict';
/**
* This code sample demonstrates an implementation of the Lex Code Hook Interface
* in order to serve a bot which manages dentist appointments.
* Bot, Intent, and Slot models which are compatible with this sample can be found in the Lex Console
* as part of the 'MakeAppointment' template.
*
* For instructions on how to set up and test this bot, as well as additional samples,
* visit the Lex Getting Started documentation.

Keybase proof

I hereby claim:

  • I am hundredwatt on github.
  • I am gaggleampjason (https://keybase.io/gaggleampjason) on keybase.
  • I have a public key whose fingerprint is 37B5 EBD2 0DA0 D058 233F A8A7 5B63 CAA2 4575 FA9B

To claim this, I am signing this object:

# Idea from: https://twitter.com/nateberkopec/status/1255573064747712515
require 'fileutils'
require 'net/http'
require 'json'
require 'uri'
require 'csv'
POINT_THRESHOLD = 400
HN_ALGOLIA_URL = 'https://hn.algolia.com/api/v1/search?query=github.com&restrictSearchableAttributes=url&page=%<page>d'

Keybase proof

I hereby claim:

  • I am hundredwatt on github.
  • I am hundredwatt (https://keybase.io/hundredwatt) on keybase.
  • I have a public key ASBjSOfVQi7igm7UAwmoDlbyPSH7dirZHg83jKoWeGCzygo

To claim this, I am signing this object:

require 'digest/sha1'
require 'net/http'
def pwned?(password)
digest = Digest::SHA1.hexdigest(password).upcase
prefix = digest[0,5]
suffix = digest[5,256]
uri = URI.parse("https://api.pwnedpasswords.com/range/" + prefix)
# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
gem "rails"
# If you want to test against edge Rails replace the previous line with this:
# gem "rails", github: "rails/rails", branch: "main"
# Temporary build stage to build the xid_wraparound extension
FROM debian:bookworm-slim AS build
# Download Postgres REL_17_STABLE branch
RUN apt-get update && apt-get install -y unzip wget
RUN wget https://github.com/postgres/postgres/archive/refs/heads/REL_17_STABLE.zip -O postgres.zip && \
unzip postgres.zip
# Install Postgres build dependencies, source: https://wiki.postgresql.org/wiki/Compile_and_Install_from_source_code
RUN apt-get install -y build-essential libreadline-dev zlib1g-dev flex bison libxml2-dev libxslt-dev libssl-dev libxml2-utils xsltproc ccache pkg-config