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
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\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\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"
SIGNATURE_BASE64 = "MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIIHTCCA20wggJVoAMCAQICEESzOh1IytmdQqbap8VUON0wDQYJKoZIhvcNAQEFBQAwSTETMBEGCgmSJomT8ixkARkWA25ldDEWMBQGCgmSJomT8ixkARkWBnByb21kbTEaMBgGA1UEAxMRUHJvbWRtTkVUUm9vdENBdjEwHhcNMTIwOTI1MDgyODI2WhcNMzIwOTI1MDgzODI1WjBJMRMwEQYKCZImiZPyLGQBGRYDbmV0MRYwFAYKCZImiZPyLGQBGRYGcHJvbWRtMRowGAYDVQQDExFQcm9tZG1ORVRSb290Q0F2MTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAN43J/4Pimp7CEO7mA7V9A+Dj9NX1Cz0x97SncGqkh+x1xz6Ofoiq9vV2UC5DYIvGf3VVWErPwSXVQJ1Jd/uksCkVktC9zUfInYTb8dSGZ3MdrIntT83XWCkzPAjPZHOicBvU0hRCoY6r/FoQbVAIH+FnuEaGmXM+SYVbed6OLf3RN3DJPFw7y0xiJr3DRg
@zmajstor
zmajstor / saml_response.html
Created Feb 22, 2015
SAML response with "POST redirect"
View saml_response.html
<html xmlns="http://www.w3.org/1999/xhtml" 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();">
<noscript>
<p><strong>Note:</strong> Since your browser does not support JavaScript, you must press the button below once to proceed.</p>
</noscript>
@zmajstor
zmajstor / README.md
Created Feb 17, 2015
AAI@EduH authentication for Ruby on Rails apps
View README.md
@zmajstor
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)
# http://stackoverflow.com/questions/8431528/nginx-ssl-certificate-authentication-signed-by-intermediate-ca-chain?rq=1
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
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
# https://github.com/rails/docrails/blob/master/activesupport/lib/active_support/key_generator.rb
salt = SecureRandom.random_bytes(64)
key = ActiveSupport::KeyGenerator.new('password1234').generate_key(salt)
encryptor = ActiveSupport::MessageEncryptor.new(key)
message = "Secret message in plain text"
@zmajstor
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
zmajstor / smart_card_adapter.rb
Created Aug 23, 2014
SmartCard adapter using smartcard gem with demo
View smart_card_adapter.rb
# http://www.rdoc.info/github/costan/smartcard/master/Smartcard
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 = Smartcard::PCSC::Context.new(scope)
end
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 1.3.6.1.4.1.311.20.2.3)
# Format: user@domain
# Encoding: UTF-8
# Matching: case ignore
# e.g.
# otherName=1.3.6.1.4.1.311.20.2.3;UTF8:bobOtherAltName@example.com
You can’t perform that action at this time.