Skip to content

Instantly share code, notes, and snippets.

View ruby-dev's full-sized avatar

Dustin Ward ruby-dev

  • SSL.com
  • Katy, TX
View GitHub Profile
@eritbh
eritbh / op-add-identities
Last active June 8, 2023 15:44
1password SSH identity management helpers
#!/bin/bash
echo "Signing into 1password..."
eval $(op signin $@)
items=($(op list items | jq '.[] | select(.templateUuid == "110") | .uuid' --raw-output))
for uuid in "${items[@]}"; do
item_data="$(op get item "$uuid")"
private_key="$(echo "$item_data" | jq '.details.sections[0].fields[] | select(.t == "ssh private key") | .v' --raw-output)"
item_title="$(echo "$item_data" | jq '.overview.title' --raw-output)"
@VishalTaj
VishalTaj / crud_concern_rails.rb
Last active September 28, 2024 05:41
CRUD Concern for Rails Controllers
module CrudConcern
extend ActiveSupport::Concern
# Rails version < 5
##################################################################
# This module take cares the CRUD controller methods #
# #
# Note: add skip_before_action if you want to ignore any of the #
# above action to be loaded from module #
##################################################################
@DarthPumpkin
DarthPumpkin / tor.sh
Last active October 25, 2022 18:31
OS X shell script for routing all traffic through tor. Requires tor to be installed (brew install tor). Taken from https://kremalicious.com/simple-tor-setup-on-mac-os-x/, modified from http://leonid.shevtsov.me/en/an-easy-way-to-use-tor-on-os-x To stop using tor just terminate this script with Ctrl C
#!/usr/bin/env bash
# 'Wi-Fi' or 'Ethernet' or 'Display Ethernet'
INTERFACE=Wi-Fi
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
@matiaskorhonen
matiaskorhonen / sign-pdf.rb
Last active March 21, 2025 02:34
Quick and dirty PDF signing in Ruby (using Origami)
#!/usr/bin/env ruby
require "openssl"
require "time"
begin
require "origami"
rescue LoadError
abort "origami not installed: gem install origami"
end