Skip to content

Instantly share code, notes, and snippets.

View cjbottaro's full-sized avatar

Christopher J. Bottaro cjbottaro

  • AcademicWorks, Inc
  • Austin, Tx
View GitHub Profile
@cjbottaro
cjbottaro / linux-de-setup-2023.md
Last active March 30, 2024 00:46
Linux Desktop (KDE) Setup in 2023

Goal

We all know that MacOS is by far the best, so we're trying to emulate that as much as possible... :)

Keyboard Shortcuts

Here are the ones that I can't live without:

  • Move cursor to beginning/end of line cmd-left cmd-right
  • Move cursor by word opt-left opt-right
  • Move cursor to beginning/end of document cmd-up cmd-down
@cjbottaro
cjbottaro / textract_sqs.ex
Created September 19, 2019 01:49
Polls SQS for Textract messages and hands them off to our queuing system
defmodule SqsTextractPoller do
use Task, restart: :permanent
require Logger
def start_link(args) do
Task.start_link(__MODULE__, :run, args)
end
def run do
queue_url = Application.get_env(:app, :aws)[:textract_sqs_url]
@cjbottaro
cjbottaro / kube-router.yaml
Created January 7, 2019 21:57
kube-router.yaml with hostPort and arm support
apiVersion: v1
kind: ConfigMap
metadata:
name: kube-router-cfg
namespace: kube-system
labels:
tier: node
k8s-app: kube-router
data:
cni-conf.json: |
@cjbottaro
cjbottaro / kube-router-configmap-patch.yaml
Created December 15, 2018 05:40
HostPort for kube-router
data:
cni-conf.json: |-
{
"cniVersion":"0.3.0",
"name":"kube-router-net",
"plugins":[
{
"name":"kubernetes",
"type":"bridge",
"bridge":"kube-bridge",
@cjbottaro
cjbottaro / gist:2926951
Created June 13, 2012 22:41
Adding methods to ActiveRecord::Relation to wrap results
require "spec_helper"
class RecordWrapper
def initialize(record)
@record = record
end
end
module RelationWrapping
@cjbottaro
cjbottaro / overlay.sh
Last active November 13, 2018 15:06
Convert ECS Optimized AMI to use overlay/overlay2
set -e
# Stop the docker daemon
/etc/init.d/docker stop
# Configure ECS Agent
# http://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-agent-config.html
# http://docs.aws.amazon.com/AmazonECS/latest/developerguide/automated_image_cleanup.html
cat > /etc/ecs/ecs.config << "EOF"
ECS_ENGINE_TASK_CLEANUP_WAIT_DURATION=1h
@cjbottaro
cjbottaro / config.exs
Created May 4, 2017 19:50
Different log level for different otp apps
config :gnat, logger: [
level: :info
]
[88396] 2016/12/30 10:36:39.184894 [DBG] 127.0.0.1:49506 - cid:73 - Client connection created
[88396] 2016/12/30 10:36:39.185146 [TRC] 127.0.0.1:49506 - cid:73 - ->> [CONNECT {"version":"1.3","verbose":true,"protocol":1,"pedantic":false,"lang":"elixir"}]
[88396] 2016/12/30 10:36:39.185191 [TRC] 127.0.0.1:49506 - cid:73 - <<- [OK]
[88396] 2016/12/30 10:36:39.185439 [TRC] 127.0.0.1:49506 - cid:73 - ->> [SUB one_off.c4b487b4 c4b487b4]
[88396] 2016/12/30 10:36:39.185464 [TRC] 127.0.0.1:49506 - cid:73 - <<- [OK]
[88396] 2016/12/30 10:36:39.185622 [TRC] 127.0.0.1:49506 - cid:73 - ->> [UNSUB c4b487b4 1]
[88396] 2016/12/30 10:36:39.185634 [DBG] 127.0.0.1:49506 - cid:73 - Deferring actual UNSUB(one_off.c4b487b4): 1 max, 0 received
[88396] 2016/12/30 10:36:39.185640 [TRC] 127.0.0.1:49506 - cid:73 - <<- [OK]
[88396] 2016/12/30 10:36:39.185801 [TRC] 127.0.0.1:49506 - cid:73 - ->> [PUB _STAN.discover.test-cluster one_off.c4b487b4 28]
[88396] 2016/12/30 10:36:39.185812 [TRC] 127.0.0.1:49506 - cid:73 - ->> MSG_PAYLOAD: [
[88396] 2016/12/30 10:44:24.125227 [DBG] 127.0.0.1:49823 - cid:74 - Client connection created
[88396] 2016/12/30 10:44:24.125523 [TRC] 127.0.0.1:49823 - cid:74 - ->> [CONNECT {"verbose":false,"pedantic":false,"tls_required":false,"name":"myID","lang":"go","version":"1.2.2","protocol":1}]
[88396] 2016/12/30 10:44:24.125556 [TRC] 127.0.0.1:49823 - cid:74 - ->> [PING]
[88396] 2016/12/30 10:44:24.125559 [TRC] 127.0.0.1:49823 - cid:74 - <<- [PONG]
[88396] 2016/12/30 10:44:24.125743 [TRC] 127.0.0.1:49823 - cid:74 - ->> [SUB _INBOX.5ohrcxqldd6BBjQNCONih0 1]
[88396] 2016/12/30 10:44:24.125765 [TRC] 127.0.0.1:49823 - cid:74 - ->> [SUB _INBOX.5ohrcxqldd6BBjQNCONikd 2]
[88396] 2016/12/30 10:44:24.125772 [TRC] 127.0.0.1:49823 - cid:74 - ->> [UNSUB 2 1]
[88396] 2016/12/30 10:44:24.125779 [DBG] 127.0.0.1:49823 - cid:74 - Deferring actual UNSUB(_INBOX.5ohrcxqldd6BBjQNCONikd): 1 max, 0 received
[88396] 2016/12/30 10:44:24.125784 [TRC] 127.0.0.1:49823 - cid:74 - ->> [PUB _STAN.discover.test-cluster _INBOX.5ohrcxqldd6BBjQNCO
@cjbottaro
cjbottaro / gist:9163450
Last active November 18, 2016 19:18
Memoizing in Ruby 2 with prepend
module Memoizable
def self.extended(mod)
mod.module_eval{ prepend(@memoizer = Module.new) }
end
def memoize(name)
@memoizer.module_eval do
define_method(name) do |*args, &block|
raise(ArgumentError, "cannot memoize method called with block") if block