Skip to content

Instantly share code, notes, and snippets.

Avatar
🕶️
busy, busy

Mike Bijon mbijon

🕶️
busy, busy
View GitHub Profile
@mbijon
mbijon / gist:2ddf2bfecd58e4921c1350f495261a80
Created Jun 20, 2017
Ruby AES Encryption using OpenSSL
View gist:2ddf2bfecd58e4921c1350f495261a80
#!/usr/bin/env ruby
require "openssl"
require 'digest/sha2'
require 'base64'
# We use the AES 256 bit cipher-block chaining symetric encryption
alg = "AES-256-CBC"
# We want a 256 bit key symetric key based on some passphrase
digest = Digest::SHA256.new
@mbijon
mbijon / gist:5116961cdb728bcaa006a9932d42cb2d
Created Jun 20, 2017
Ruby AES Encryption using OpenSSL
View gist:5116961cdb728bcaa006a9932d42cb2d
#!/usr/bin/env ruby
require "openssl"
require 'digest/sha2'
require 'base64'
# We use the AES 256 bit cipher-block chaining symetric encryption
alg = "AES-256-CBC"
# We want a 256 bit key symetric key based on some passphrase
digest = Digest::SHA256.new
@mbijon
mbijon / xcode8.js
Created Apr 17, 2017 — forked from dpogue/xcode8.js
Hook for Cordova iOS to support "developmentTeam" in buildConfig.json
View xcode8.js
"use strict";
var fs = require('fs');
var path = require('path');
module.exports = function(context) {
var encoding = 'utf-8';
var filepath = 'platforms/ios/cordova/build.xcconfig';
if (context.opts.cordova.platforms.indexOf('ios') === -1) return;
@mbijon
mbijon / xcode8.js
Created Apr 17, 2017 — forked from dpogue/xcode8.js
Hook for Cordova iOS to support "developmentTeam" in buildConfig.json
View xcode8.js
"use strict";
var fs = require('fs');
var path = require('path');
module.exports = function(context) {
var encoding = 'utf-8';
var filepath = 'platforms/ios/cordova/build.xcconfig';
if (context.opts.cordova.platforms.indexOf('ios') === -1) return;
@mbijon
mbijon / gist:13798111e7bf56f2268626c4e1d21b07
Created Jan 26, 2017 — forked from mattconnolly/gist:4158961
RSpec basic authentication helper module for request and controller specs
View gist:13798111e7bf56f2268626c4e1d21b07
module AuthHelper
def http_login
user = 'username'
pw = 'password'
request.env['HTTP_AUTHORIZATION'] = ActionController::HttpAuthentication::Basic.encode_credentials(user,pw)
end
end
module AuthRequestHelper
#
View optional-polyfill.js
var scripts = ['app.a700a9a3e91a84de5dc0.js']; // script for all users
var newBrowser = (
'fetch' in window &&
'Promise' in window &&
'assign' in Object &&
'keys' in Object
);
if (!newBrowser) {
@mbijon
mbijon / juggernaut.rb
Created Dec 22, 2016 — forked from maccman/juggernaut.rb
Sinatra Server Side Event streaming.
View juggernaut.rb
# Usage: redis-cli publish message hello
require 'sinatra'
require 'redis'
conns = []
get '/' do
erb :index
end
@mbijon
mbijon / juggernaut_channels.rb
Created Dec 22, 2016 — forked from maccman/juggernaut_channels.rb
Sinatra Server Side Event streaming with private channels.
View juggernaut_channels.rb
# Usage: redis-cli publish message.achannel hello
require 'sinatra'
require 'redis'
conns = Hash.new {|h, k| h[k] = [] }
Thread.abort_on_exception = true
get '/' do
@mbijon
mbijon / canvasrecord.js
Created Nov 6, 2016 — forked from PaulKinlan/canvasrecord.js
Screen recorder in JS
View canvasrecord.js
(function() {
let canvas = document.querySelector('canvas');
// Optional frames per second argument.
let stream = canvas.captureStream(25);
let recorder = new MediaRecorder(stream, options);
let blobs = [];
function download(blob) {
var url = window.URL.createObjectURL(blob);
var a = document.createElement('a');
@mbijon
mbijon / move_to_rds.rb
Created Oct 10, 2016 — forked from guenter/move_to_rds.rb
A quick and dirty script to move a database into Amazon RDS (or any other database). Can transfer part of the data beforehand.
View move_to_rds.rb
require 'fileutils'
start_time = Time.now
SOURCE_DB = {
:name => 'db_name',
:user => 'db_user',
:password => 'db_pass',
:host => 'localhost'