Skip to content

Instantly share code, notes, and snippets.

@bhornseth
bhornseth / post.py
Created May 2, 2014 16:56
Simple tornado server
#!/usr/bin/env python
import tornado.ioloop
import tornado.web
import pprint
import urllib
class MyDumpHandler(tornado.web.RequestHandler):
def post(self):
unquoted = urllib.unquote(self.request.body)
@bhornseth
bhornseth / README.md
Created January 18, 2016 15:34 — forked from datagrok/README.md
What happens when you cancel a Jenkins job

When you cancel a Jenkins job

Unfinished draft; do not use until this notice is removed.

We were seeing some unexpected behavior in the processes that Jenkins launches when the Jenkins user clicks "cancel" on their job. Unexpected behaviors like:

  • apparently stale lockfiles and pidfiles
  • overlapping processes
  • jobs apparently ending without performing cleanup tasks
  • jobs continuing to run after being reported "aborted"
@bhornseth
bhornseth / Instrument Anything in Rails 3.md
Created February 25, 2016 20:43 — forked from mnutt/Instrument Anything in Rails 3.md
How to use Rails 3.0's new notification system to inject custom log events

Instrument Anything in Rails 3

With Rails 3.0 released a few weeks ago I've migrated a few apps and I'm constantly finding useful new improvements. One such improvement is the ability to log anything in the same way that Rails internally logs ActiveRecord and ActionView. By default Rails 3 logs look slightly spiffier than those produced by Rails 2.3: (notice the second line has been cleaned up)

Started GET "/" for 127.0.0.1 at Mon Sep 06 01:07:11 -0400 2010
  Processing by HomeController#index as HTML
  User Load (0.2ms)  SELECT `users`.* FROM `users` WHERE (`users`.`id` = 3) LIMIT 1
  CACHE (0.0ms)  SELECT `users`.* FROM `users` WHERE (`users`.`id` = 3) LIMIT 1

Rendered layouts/_nav.html.erb (363.4ms)

@bhornseth
bhornseth / vimrc
Created August 12, 2016 21:06 — forked from Arkham/vimrc
Convert old rspec should syntax to new expect syntax
function! ConvertShouldToExpect()
let rspec_conversions = {
\ 'should': 'to',
\ 'should_not': 'not_to',
\ 'should_receive': 'to receive',
\ 'should_not_receive': 'not_to receive',
\ }
for [old, new] in items(rspec_conversions)
execute "normal! " . ':%s/\v^(\s+)(.+)\.' . old . '>/\1expect(\2).' . new . '/ge' . "\<CR>"
@bhornseth
bhornseth / ruby_gems_age.rb
Created August 19, 2019 13:30 — forked from borama/ruby_gems_age.rb
A script that collects and prints info about the age of all ruby gems in your project, see https://dev.to/borama/how-old-are-dependencies-in-your-ruby-project-3jia
#!/bin/env ruby
#
# Collects info about the age of all gems in the project
#
require "json"
require "date"
bundle = `bundle list`
yearly_stats = {}
bhornseth@bhornseth-mbp ~ $ nslookup www.midco.net
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
Name: www.midco.net
Address: 24.220.0.105
bhornseth@bhornseth-mbp ~ $ traceroute 24.220.0.105
traceroute to 24.220.0.105 (24.220.0.105), 64 hops max, 52 byte packets
Sat Jan 11 10:01:13 CST 2020: PING 24.220.182.52 (24.220.182.52) 56(84) bytes of data.
Sat Jan 11 10:01:13 CST 2020: 64 bytes from 24.220.182.52: icmp_seq=1 ttl=254 time=8.73 ms
Sat Jan 11 10:01:14 CST 2020: 64 bytes from 24.220.182.52: icmp_seq=2 ttl=254 time=9.97 ms
Sat Jan 11 10:01:15 CST 2020: 64 bytes from 24.220.182.52: icmp_seq=3 ttl=254 time=8.70 ms
Sat Jan 11 10:01:16 CST 2020: 64 bytes from 24.220.182.52: icmp_seq=4 ttl=254 time=8.85 ms
Sat Jan 11 10:01:17 CST 2020: 64 bytes from 24.220.182.52: icmp_seq=5 ttl=254 time=9.00 ms
Sat Jan 11 10:01:18 CST 2020: 64 bytes from 24.220.182.52: icmp_seq=6 ttl=254 time=25.5 ms
Sat Jan 11 10:01:19 CST 2020: 64 bytes from 24.220.182.52: icmp_seq=7 ttl=254 time=10.4 ms
Sat Jan 11 10:01:20 CST 2020: 64 bytes from 24.220.182.52: icmp_seq=8 ttl=254 time=8.43 ms
Sat Jan 11 10:01:21 CST 2020: 64 bytes from 24.220.182.52: icmp_seq=9 ttl=254 time=26.6 ms
@bhornseth
bhornseth / main.tf
Created March 27, 2022 12:26 — forked from danihodovic/main.tf
Terraform - static site using S3, Cloudfront and Route53
variable "aws_region" {
default = "eu-west-1"
}
variable "domain" {
default = "my_domain"
}
provider "aws" {
region = "${var.aws_region}"