Skip to content

Instantly share code, notes, and snippets.

View vesan's full-sized avatar

Vesa Vänskä vesan

View GitHub Profile
@amkisko
amkisko / noko_importer.rb
Last active October 15, 2023 08:44
Noko entries importer
# AUTHOR: Andrei Makarov (github.com/amkisko)
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
gem "noko"
gem "dotenv"
gem "active_support"
@janko
janko / application_controller.rb
Last active November 7, 2023 21:25
Implementing Devise groups in Rodauth
class ApplicationController < ActionController:Base
extend ControllerMacros
end
@jaydorsey
jaydorsey / private_bundle_install_gist.md
Last active April 28, 2025 23:49
Setting up a github/bundle token for privately hosted repos

If your Gemfile has a privately hosted package referenced similar to this:

gem 'sekret', git: 'https://github.com/my-private-group/sekret.git', branch: 'main'

You may see a prompt when running bundle install, or other bundler commands, to enter your github username & password.

To resolve this, you need to generate a token and add it to your system.

Generating a token

@amkisko
amkisko / _rails-tuples-readme.md
Last active March 10, 2022 11:30
Rails tuples

Rails tuples

Simple key-value storage with data types and expiration control.

Session 1:
1 Prior Analytics (∼350 BCE) 1
2 The True Method (1677) 5
3 Sketch of the Analytical Engine (1843) 9
4 An Investigation of the Laws of Thought on Which Are Founded the Mathematical Theories of Logic and Probabilities (1854) 27
5 Mathematical Problems (1900) 45
Session 2:
6 On Computable Numbers, with an Application to the Entscheidungsproblem (1936) 51

Beautiful Bash

until something is true

if "creation" command fails, sleep 1

while true; do
  kubectl get namespace mynamespace && break
 kubectl create namespace mynamespace || sleep 1
# Rails production setup via SQLite3 made durable by https://litestream.io/
# Copy this to Dockerfile on a fresh rails app. Deploy to fly.io or any other container engine.
#
# try locally: docker build . -t rails && docker run -p3000:3000 -it rails
#
# in production you might want to map /data to somewhere on the host,
# but you don't have to!
#
FROM ruby:3.0.2
@amkisko
amkisko / README_TERRAFORM_SSM_PARAMETERS_MANAGEMENT.md
Last active November 25, 2021 08:47
SSM parameters management using terraform

SSM parameters management with terraform

Module definition

Copy main.tf, output.tf, variables.tf to modules/ssm_parameters folder (or whatever folder that will be mentioned in source attribute for the module)

Module inclusion

module "ssm_parameters" {
@heridev
heridev / content.md
Created October 13, 2021 00:29
Third party SAML Single Sign On (SSO) integration/implementation - Tech spec

Third party SAML Single Sign On (SSO) integration/implementation - Tech spec

  • Author: Heriberto Perez

Background

The implementation of SSO in order to connect with other services/providers/sites is a common requirement these days

For those cases when you have the need to integrate a third party service and embed some widgets in your site, and in order to make it in a secure way and based on dynamic data for the current authenticated, that is when the SSO integration comes handy for you.

Goals

This Tech spec will serve as a reference a SAML Single Sign On (SSO) integration.

@zealot128
zealot128 / rails-models-to-typescript-schema.rb
Last active July 1, 2024 16:05
Simple ruby script to generate Active Record Typescript information with enums + associations
# USAGE:
# rails runner rails-models-to-typescript-schema.rb > app/javascript/types/schema.d.ts
Rails.application.eager_load!
models = ActiveRecord::Base.descendants.reject { |i| i.abstract_class? }
belongs_to = true
has_many = true