Skip to content

Instantly share code, notes, and snippets.

@smook1980
smook1980 / gist:b43ec2bdfaa9ef475b39
Last active August 29, 2015 14:05
Testing MRI threads with ActiveRecord's sql server driver. Shows the sql server driver blocks on IO under MRI.
#! /usr/bin/env ruby
# Adapted from slide 5 at http://www.slideshare.net/igrigorik/no-callbacks-no-threads-railsconf-2010
require 'bundler/setup'
require 'active_record'
require 'tiny_tds'
require 'active_record/connection_adapters/sqlserver_adapter'
ActiveRecord::Base.establish_connection(
:adapter => 'sqlserver',
#!/usr/bin/env ruby
require 'securerandom'
CURRENT_NO_DB_RECORDS = 6_146_992
FACTOR = 10
ITERATIONS = CURRENT_NO_DB_RECORDS * FACTOR
def compute_hash_frequency
hash_counts = { }
;;; packages.el --- rspec Layer packages File for Spacemacs
;;
;; Copyright (c) 2012-2014 Sylvain Benner
;; Copyright (c) 2014-2015 Sylvain Benner & Contributors
;;
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;

So the anyconnect client prevents forward of traffic from a VM to the VPN, which means virtual machines and docker containers which rely upon NAT won't work. OpenConnect allows you to get around this as it doesn't enforce ipfw rules upon you.

OpenConnect is a command-line client for Cisco's AnyConnect SSL VPN.

Here's how to get it set up on Mac OS X:

  1. OpenConnect can be installed via homebrew:

     brew update
    

brew install openconnect

@smook1980
smook1980 / logtail.go
Last active August 29, 2015 14:22 — forked from taotetek/logtail.go
package main
import (
"fmt"
czmq "github.com/zeromq/goczmq"
)
func main() {
serverCert, _ := czmq.NewCertFromFile("/etc/curve.d/example_curve_server_cert")
@smook1980
smook1980 / change_tracking.rb
Created September 30, 2015 20:41
A Mixin To Add Attribute Change Tracking to Models
require 'active_support/concern'
module Model
ChangeEvent = Struct.new(:event, :condition)
class ChangeTracker
def initialize
@attributes = {}
end
@smook1980
smook1980 / curvecp_handshake.rb
Created December 3, 2015 08:18 — forked from grantr/curvecp_handshake.rb
CurveCP handshake protocol in Ruby
# A demonstration of the CurveCP handshake protocol. This protocol has many
# favorable security properties described at http://curvecp.org.
#
# In addition to its security advantages, it has the following favorable properties:
# * Needs only 2 messages (1 from client, 1 from server) before application
# messages can be exchanged (3 before the server can send application messages)
# * Does not require the server to keep protocol state between handshake messages.
#
# An overview of the protocol:
#
@smook1980
smook1980 / Vagrantfile
Created December 14, 2015 17:54 — forked from anthonysterling/Vagrantfile
Handy Vagrantfile for IE testing with Vagrant.
# Usage: IE={box} vagrant up
#
# Eg. IE=XPIE6 vagrant up
boxes = {
"XPIE6" => "http://aka.ms/vagrant-xp-ie6",
"XPIE8" => "http://aka.ms/vagrant-xp-ie8",
"VistaIE7" => "http://aka.ms/vagrant-vista-ie7",
"Win7IE8" => "http://aka.ms/vagrant-win7-ie8",
"Win7IE9" => "http://aka.ms/vagrant-win7-ie9",
package main
import (
"encoding/json"
"log"
"os"
"os/exec"
"github.com/docker/containerd/osutils"
)
@smook1980
smook1980 / smook-theme.fish
Last active September 16, 2016 23:27
Modified Pure Fish Theme With Vi Mode
#!/usr/bin/env fish
# vim: set ft=sh:
# Pure
# by Rafael Rinaldi
# https://github.com/rafaelrinaldi/pure
# MIT License
# Whether or not is a fresh session
set -g fresh_session 1