Skip to content

Instantly share code, notes, and snippets.

View jsomara's full-sized avatar

Jordan OMara jsomara

  • Redwood City, CA
View GitHub Profile
@jsomara
jsomara / README
Created October 10, 2017 17:41
mediawiki ldap config
- use this plugin: https://www.mediawiki.org/wiki/Extension:LDAP_Authentication/Configuration_Options
- First, create a user in the wiki in the database with your own LDAP username, and set them as a `sysop`
- install the plugin for your OS as per the directions
- connect to the wiki db and add the `ldap_domains` table as mentioned above
- update the configuration file with your own settings, including the user & pass of your LDAP binder, the group (if required) for users, etc
- restart nginx or apache
- login with foxpass password

Keybase proof

I hereby claim:

  • I am jsomara on github.
  • I am jsomara (https://keybase.io/jsomara) on keybase.
  • I have a public key ASAP1NQYu_C9Je6bPfj4S_A9JgrI5KKUZGtF7sOYnuzRNAo

To claim this, I am signing this object:

@jsomara
jsomara / vpn.yml
Last active December 9, 2016 00:00
vpn automation
---
- name: Generate PSK for vpn config
local_action: shell od -vAn -N4 -tx < /dev/urandom
register: psk
tags:
- newvpn
- debug: var=psk.stdout_lines[0]
tags:
- newvpn
@jsomara
jsomara / s3_signer.rb
Created August 18, 2016 22:01
S3 Signature Request Process v4, in ruby/rails
# Algorithm: http://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-authentication-HTTPPOST.html
# policy_params are the input policy as a rails request param object, which expects :conditions & :expiration
class S3Signer
def self.get_signature_key(key, date_stamp, region_name, service_name)
k_date = OpenSSL::HMAC.digest('sha256', "AWS4" + key, date_stamp)
k_region = OpenSSL::HMAC.digest('sha256', k_date, region_name)
k_service = OpenSSL::HMAC.digest('sha256', k_region, service_name)
k_signing = OpenSSL::HMAC.digest('sha256', k_service, "aws4_request")
@jsomara
jsomara / striper-subscription.rb
Last active October 21, 2015 11:46
stripe webhook processing
class Striper::SubscriptionCanceledEvent < Striper
def process
return unless user && log
clear_customer_roles(user)
UserMailer.unsubscribe_email(user).deliver
end
end
angular.module('hz').directive({
heatParameter: [function () {
return {
restrict: 'A',
require: '^ngModel',
transclude: true,
scope: {
param: '='
},
class Api::BaseController < ApplicationController
before_filter :authenticate_user!, :except => [:options]
before_filter :subscribed_user, :except => [:options]
...
def options
headers['Access-Control-Allow-Origin'] = '*'
headers['Access-Control-Allow-Methods'] = 'GET, POST, PUT, DELETE, OPTIONS'
headers['Access-Control-Max-Age'] = '1000'
angular.module('hz').factory
('SatelliteErrata', ['$resource', 'Base64',
function ($resource, Base64) {
var SatelliteErrata = $resource('https://sat-perf-05.idm.lab.bos.redhat.com/katello/api/v2/systems/:id/errata', {id: '@uuid'}, {
get: {
method: 'GET',
isArray: false
angular.module('Arc')
.factory('basicAuth', ['$cookieStore', '$http', 'Base64', function ($cookieStore, $http, Base64) {
return {
setCredentials: function (token) {
var encoded = Base64.encode(token + ':X');
$http.defaults.headers.common.Authorization = 'Basic ' + encoded;
$cookieStore.put('authdata', encoded);
},
clearCredentials: function () {
document.execCommand("ClearAuthenticationCache");
<nav id='head-nav' class="topbar navbar navbar-default navbar-fixed-top" role="navigation">
<div class="navbar-header">
<img src="assets/images/logo-small.png" />
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-right">
<li data-ng-repeat="item in Menu" ui-sref-active="active">
<a ui-sref="{{item.link}}">{{item.title}}</a>
</li>
<li>