Skip to content

Instantly share code, notes, and snippets.

View mbround18's full-sized avatar
😍
Designing

Michael mbround18

😍
Designing
View GitHub Profile

Github Action/Workflow Updater

Requirements

  • yq
  • gh
  • gh logged into github

Usage

@mbround18
mbround18 / convert-UNIX-timestamp.js
Created October 10, 2016 04:03 — forked from kmaida/convert-UNIX-timestamp.js
Convert a UNIX timestamp to user's local time via JavaScript
function convertTimestamp(timestamp) {
var d = new Date(timestamp * 1000), // Convert the passed timestamp to milliseconds
yyyy = d.getFullYear(),
mm = ('0' + (d.getMonth() + 1)).slice(-2), // Months are zero based. Add leading 0.
dd = ('0' + d.getDate()).slice(-2), // Add leading 0.
hh = d.getHours(),
h = hh,
min = ('0' + d.getMinutes()).slice(-2), // Add leading 0.
ampm = 'AM',
time;
@mbround18
mbround18 / app.rb
Created June 16, 2016 23:10 — forked from hendrikswan/app.rb
sample sinatra mongodb service
require 'sinatra'
require 'mongoid'
require 'json'
require "sinatra/reloader" if development?
Mongoid.load!("mongoid.yml")
class Price
include Mongoid::Document
@mbround18
mbround18 / gist:b2b1f6477cafb07fa769cbffa95b7dda
Created May 3, 2016 00:31 — forked from RiANOl/gist:1077760
AES128 / AES256 CBC with PKCS7Padding in Ruby
require "openssl"
require "digest"
def aes128_cbc_encrypt(key, data, iv)
key = Digest::MD5.digest(key) if(key.kind_of?(String) && 16 != key.bytesize)
iv = Digest::MD5.digest(iv) if(iv.kind_of?(String) && 16 != iv.bytesize)
aes = OpenSSL::Cipher.new('AES-128-CBC')
aes.encrypt
aes.key = key
aes.iv = iv