Skip to content

Instantly share code, notes, and snippets.

View tadast's full-sized avatar

Tadas Tamošauskas tadast

View GitHub Profile
@tadast
tadast / ssl_puma.sh
Last active January 29, 2024 04:41 — forked from trcarden/gist:3295935
localhost SSL with puma
# 1) Create your private key (any password will do, we remove it below)
$ cd ~/.ssh
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
@tadast
tadast / with_active_support.rb
Last active December 10, 2018 11:41 — forked from mbyczkowski/with_active_support.rb
session cookie decrypter for Rails 5.1
require 'cgi'
require 'json'
require 'active_support'
def verify_and_decrypt_session_cookie(cookie, secret_key_base = Rails.application.secrets.secret_key_base)
cookie = CGI::unescape(cookie)
salt = 'encrypted cookie'
signed_salt = 'signed encrypted cookie'
key_generator = ActiveSupport::KeyGenerator.new(secret_key_base, iterations: 1000)
secret = key_generator.generate_key(salt)[0, ActiveSupport::MessageEncryptor.key_len]
@tadast
tadast / syntax_highlighting.py
Created November 28, 2012 15:17 — forked from JeanMertz/syntax_highlighting.py
Ruby on Rails syntax highlight switcher for Sublime Text 2
# Forked from https://gist.github.com/925008
# Makes it work with Ruby on Rails snippets
# https://github.com/tadast/sublime-rails-snippets#sublime-text-2-rails-snippets
import sublime, sublime_plugin
import os
class DetectFileTypeCommand(sublime_plugin.EventListener):
""" Detects current file type if the file's extension isn't conclusive """
""" Modified for Ruby on Rails and Sublime Text 2 """
@tadast
tadast / README.md
Last active August 29, 2015 14:25 — forked from chrisroos/README.md
Spike into ways of visualising Smart Answers

The print_graph method displays the Smart Answer as a tree.

The print_questions_and_possible_next_nodes method displays the questions and their possible next nodes.

The extraction of possible next nodes is horrible in the case where the Smart Answer uses the block syntax of next_node. I'm getting the source of the block and extracting things that look like symbols.