Skip to content

Instantly share code, notes, and snippets.

View mrstebo's full-sized avatar
💻

Steven Atkinson mrstebo

💻
View GitHub Profile
@mrstebo
mrstebo / Vagrantfile
Last active April 10, 2017 13:39
Vagrantfile for creating an Ansible control server with Ubuntu
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.provision :shell, inline: <<-SHELL
apt-get update
apt-get -y install build-essential autoconf libtool pkg-config python-dev libssl-dev
apt-get -y install python-setuptools
easy_install pip
SHELL
config.vm.provision :shell, inline: "pip install ansible"
@mrstebo
mrstebo / Vagrantfile
Created April 10, 2017 13:39
Vagrantfile for creating an Ansible control server with Ubuntu that allows SSH username and password in hosts file
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.provision :shell, inline: <<-SHELL
apt-get update
apt-get -y install build-essential autoconf libtool pkg-config python-dev libssl-dev
apt-get -y install python-setuptools sshpass
easy_install pip
SHELL
config.vm.provision :shell, inline: "pip install ansible"
@mrstebo
mrstebo / HttpRequestHeaderExtensions.cs
Created April 12, 2017 10:55
Extension method for adding a header to a HttpRequest.
using System.Collections;
using System.Reflection;
using System.Web;
namespace MyApp
{
internal static class HttpRequestHeaderExtensions
{
public static void AddHeader(this HttpRequest request, string name, string value)
{
@mrstebo
mrstebo / fakergem-build-routes.rb
Created April 19, 2017 22:19
I am lazy. Made a script to build express routes for the Fakergem library.
TEMPLATE = <<-EOF
const Faker = require('fakergem');
const { Router } = require('express');
const router = new Router();
router.get('/{route_name}', (req, res) => {
res.json({
{properties}
});
});
@mrstebo
mrstebo / README.md
Last active April 25, 2017 20:04
OpenSSL fix for Ruby

Found here

Phew.. finally got this working. What a royal pain in the ass! Here is how I did it (based on @Cl3MM post above):

  1. Download R1 GlobalSign Root Certificate: https://secure.globalsign.net/cacert/Root-R1.crt
  2. Save it somewhere local, so you can easily access it from a command prompt. It should save with the name Root-R1.crt.
  3. Convert to a PEM file. Here is where the post above didn't work for me, but this did: openssl x509 -in Root-R1.crt -out mycert.pem -outform PEM -inform DEF
  4. Copy the new mycert.pem file that it creates into: D:\Ruby23-x64\lib\ruby\2.3.0\rubygems\ssl_certs <-- this path will obviously be different depending on where you've got Ruby installed!

I can now install gems properly without any more annoying SSL errors. This was on Windows 10 Anniversary edition with Ruby 2.3.1

@mrstebo
mrstebo / snake_case_to_camel_case.rb
Created April 25, 2017 20:26
snake_case to camelCase
def snake_case_to_camel_case(text)
text.capitalize.gsub(/_(\w)/) { $1.upcase }.gsub(/^(\w)/) { $1.downcase }
end
@mrstebo
mrstebo / ultimate-ut-cheat-sheet.md
Created May 1, 2017 09:42 — forked from yoavniran/ultimate-ut-cheat-sheet.md
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai and Sinon

The Ultimate Unit Testing Cheat-sheet

For Mocha, Chai and Sinon

using mocha/chai/sinon for node.js unit-tests? check out my utility: mocha-stirrer to easily reuse test components and mock require dependencies


@mrstebo
mrstebo / Startup.cs
Created July 21, 2017 19:49
Nancy Owin Startup
using Owin;
namespace Tempest.Authorization.Web
{
public class Startup
{
public void Configuration(IAppBuilder app)
{
app.UseNancy();
}
@mrstebo
mrstebo / HomeModule.cs
Created July 21, 2017 19:53
A simple Nancy module
using Nancy;
namespace NancyApp
{
public class HomeModule : NancyModule
{
public HomeModule()
: base("/")
{
Get["/"] = Index;
@mrstebo
mrstebo / ancient.js
Created May 23, 2018 08:12
lock-step-refactoring-1
import { itemFromCollection } from '../utils/random';
const data = require('../../data/ancient.json');
export function god() {
return itemFromCollection(data['gods']);
}
export function primordial() {
return itemFromCollection(data['primordials']);