Skip to content

Instantly share code, notes, and snippets.

@dfmonaco
dfmonaco / transfer.rb
Created December 12, 2024 23:16 — forked from cschulte22/transfer.rb
Ruby script to copy files from one S3 bucket to another using aws-sdk
require 'aws-sdk'
class Transfer
def initialize(from_bucket, to_bucket)
@s3 = AWS::S3.new
@from_bucket = @s3.buckets[from_bucket]
@to_bucket = @s3.buckets[to_bucket]
raise "#{from_bucket} does not exist" unless @from_bucket.exists?
So you couldn’t wait until the update process had completed and you went for the reset/power button, didn’t you? :smiley: And now you’re getting the message that you don’t have a kernel installed. Well, you’re not the only one — we’re seeing it happen all the time. :wink:
So, here’s how to fix it, you impatient n00b. :stuck_out_tongue_winking_eye:
If you don’t happen to have a recent Manjaro installer USB/DVD/CD handy, direct your browser to this wonderful page 291, download the .iso of your choice, put it on a USB stick in the proper manner — Ventoy 167 is a great way of creating bootable USB sticks, and it’s available for Microsoft Windows too if that is what you’re currently using — and then boot up from it in live mode.
Once the desktop has loaded, open up a terminal window. In this window, issue the following command… :arrow_down:
sudo su -
From here on, the methodology will differ depending on whether you have ext4 or btrfs.
@dfmonaco
dfmonaco / composing-software.md
Created February 16, 2020 11:48 — forked from Geoff-Ford/composing-software.md
Eric Elliott's Composing Software Series
@dfmonaco
dfmonaco / arch.txt
Last active February 21, 2017 19:52
arch
Update the system clock
Use timedatectl(1) to ensure the system clock is accurate:
# timedatectl set-ntp true
To check the service status, use timedatectl status.
Partitioning
bash> fdisk /dev/sda
fdisk> g
Created a new GPT disklabel (GUID: ABC02D92-4420-4998-A39B-B39257341D68).
fdisk> n

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)

# With thanks to https://github.com/optoro/activerecord-callback_notification for original inspiration
if Rails.env.development?
module ActiveRecord
module CallbackNotifications
extend ActiveSupport::Concern
module ClassMethods
def notify_all_callbacks
# Make sure all models are loaded before trying to enumerate
@dfmonaco
dfmonaco / pr.md
Created March 26, 2013 15:39 — forked from piscisaureus/pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@dfmonaco
dfmonaco / mrdi.md
Created December 23, 2012 21:15 — forked from practicingruby/mrdi.md

Models, Roles, Decorators, and Interactions

A modest alternative to DCI that might be worth further thought

One of the problems with advancing the discussion on DCI is that we lack a comparable alternative pattern that has the same goals, but favors a low ceremony approach. The closest thing we have to that is Rails concerns, but they are more like distant relatives of the DCI concepts rather than first cousins, and that makes comparisions between the two approaches not especially fruitful.

I am considering the idea of experimenting with my own paradigm that captures the intent and purity of DCI, but with the convenience of concerns. Please note that this is just the starting point of a conversation, it is NOT a promise of comercially available cold fusion or a cure for cancer. It's just a gist with an idea on it I'd like to hear your thoughts on.

What if we had a top-level topology that was split into Models, **Rol

require 'singleton'
# outputs a colored call-trace graph to the Rails logger of the lines of ruby code
# invoked during a single request.
#
# Example:
#
# 1) Make sure this file is loaded in an initializer
#
# 2) Add the following to your application.rb in Rails3:
@dfmonaco
dfmonaco / how_it_works.md
Created December 2, 2012 13:02 — forked from rubiii/how_it_works.md
MacVim-Formatter for RSpec
$ rspec --format MacVimFormatter --color spec