Skip to content

Instantly share code, notes, and snippets.

View delkopiso's full-sized avatar

Kaosisochukwu Uzokwe delkopiso

View GitHub Profile
@delkopiso
delkopiso / dummy0.netdev
Created May 28, 2020 23:04 — forked from kquinsland/dummy0.netdev
How to get consul-agent and systemd.resolvd to co-exist peicefully and still be able to resolve *.consul hostsnames from within docker
# Creates a "dummy" network interface
# we'll configure this interface with a link-local address
# See: https://www.freedesktop.org/software/systemd/man/systemd.netdev.html
##
[NetDev]
Name=dummy0
Kind=dummy
@delkopiso
delkopiso / 20171211184922_undo_accidental_flagging.rb
Last active December 11, 2017 18:57
use and misuse of rails migrations
class UndoAccidentalFlagging < ActiveRecord::Migration[5.1]
def change
unfortunate_comment_id = 1234
unfortunate_user_id = 5678
flag = ::Flag.find_by(comment_id: unfortunate_comment_id, user_id: unfortunate_user_id)
flag.destroy!
end
end
@delkopiso
delkopiso / 20171211183835_create_flags.rb
Last active December 11, 2017 18:53
Use and misuse of rails migrations
class CreateFlags < ActiveRecord::Migration[5.1]
def change
create_table :flags do |t|
t.references :comment, foreign_key: true
t.references :user, foreign_key: true
end
end
end