Skip to content

Instantly share code, notes, and snippets.

Zoran Majstorovic zmajstor

Block or report user

Report or block zmajstor

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View pulsar.scss
.change_pending {
box-shadow: 0 0 10px 2px #eee;
-webkit-animation: scaleout 1.0s infinite ease-in-out;
animation: scaleout 1.0s infinite ease-in-out;
@-webkit-keyframes scaleout {
0% { -webkit-transform: scale(0.0) }
100% { -webkit-transform: scale(1.0); opacity: 0; }
zmajstor / pksc7_verify.rb
Created May 23, 2015
OpenSSL::PKCS7#verify test
View pksc7_verify.rb
require 'openssl'
require 'base64'
require "test/unit"
BODY = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"\">\n<plist version=\"1.0\">\n<dict>\n\t<key>Status</key>\n\t<string>Idle</string>\n\t<key>UDID</key>\n\t<string>b7ebaaa53fda9be2f7787eff7c1f4aca4e36f79d</string>\n</dict>\n</plist>\n"
zmajstor / saml_response.html
Created Feb 22, 2015
SAML response with "POST redirect"
View saml_response.html
<html xmlns="" xml:lang="en" lang="en"><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>POST data</title>
<style type="text/css"></style></head>
<body onload="document.getElementsByTagName('input')[0].click();">
<p><strong>Note:</strong> Since your browser does not support JavaScript, you must press the button below once to proceed.</p>
zmajstor /
Created Feb 17, 2015
AAI@EduH authentication for Ruby on Rails apps
zmajstor / ca_chain.conf
Last active Aug 29, 2015
nginx for Rails development
View ca_chain.conf
# NGinx SSL certificate authentication signed by intermediate CA (chain)
server {
listen 443 ssl;
ssl_certificate ...
ssl_certificate_key ...
ssl_client_certificate /path/to/ca.crt;
View .bash_profile
xport PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
# Git branch in prompt.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
export PS1="\u@\h \W\[\033[32m\]\$(parse_git_branch)\[\033[00m\] $ "
export EDITOR='mate -w'
# export LANG=hr_HR.UTF-8
zmajstor / rails_encryptor.rb
Created Sep 14, 2014
ActiveSupport MessageVerifier and MessageEncryptor samples
View rails_encryptor.rb
require 'active_support'
require 'active_support/key_generator'
# KeyGenerator is part of Rails since v4.0.0
salt = SecureRandom.random_bytes(64)
key ='password1234').generate_key(salt)
encryptor =
message = "Secret message in plain text"
zmajstor / devices_controller.rb
Last active Aug 29, 2015
Simple API sample (responds with json or xml)
View devices_controller.rb
class API::V1::DevicesController < ApplicationController
before_filter :authenticate!
before_filter :find_device, only: [:update, :destroy, :capability, :push_mdm_commands]
skip_before_filter :verify_authenticity_token
respond_to :json, :xml
rescue_from ActiveRecord::RecordNotFound, with: :record_not_found_error
# curl -v -k -X GET -H "Content-Type: application/json" -H "Accept: application/json" -H 'Authorization: Token token=justesting' https://localhost:8443/api/v1/devices
# default response format is json, append .xml for XML output: https://localhost:8443/api/v1/devices.xml
zmajstor / smart_card_adapter.rb
Created Aug 23, 2014
SmartCard adapter using smartcard gem with demo
View smart_card_adapter.rb
require 'smartcard'
class SmartCardAdapter
# scope of the smart-card connection; valid values are :system, :user, and :terminal
# (see the SCARD_SCOPE_ constants in the PC/SC API)
def connect(scope = :system)
@context =
View certificate_helper.rb
require 'openssl' unless defined? OpenSSL
# improved extraction and validation of the subjectAltName X509 extension for
# Universal Principal Name (UPN)
# Widely deployed Microsoft OtherName name form (OID
# Format: user@domain
# Encoding: UTF-8
# Matching: case ignore
# e.g.
# otherName=;
You can’t perform that action at this time.