Skip to content

Instantly share code, notes, and snippets.

Marc Abramowitz msabramo

Block or report user

Report or block msabramo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
msabramo / files_from_fixtures_in_cypress.js
Last active Mar 7, 2019
Trying to get File objects from fixtures in
View files_from_fixtures_in_cypress.js
function getFile(f) {
return new Cypress.Promise((resolve, reject) => {
return cy.fixture(f).then((img) => {
const file = makeFile({
name: f,
dataURL: `data:image/${f.slice(f.length - 3)};base64,${img}`,
msabramo / swagger.yaml
Last active Aug 23, 2018
Toy swagger file
View swagger.yaml
openapi: 3.0.0
title: Sample API
description: Optional multiline or single-line description in [CommonMark]( or HTML.
version: 0.1.9
- url:
description: Optional server description, e.g. Main (production) server
- url:
description: Optional server description, e.g. Internal staging server for testing
msabramo /
Created Feb 22, 2018
A sample
from locust import HttpLocust, TaskSet, task
class UserBehavior(TaskSet):
# def on_start(self):
# """ on_start is called when a Locust start before any task is scheduled """
# self.login()
def index(self):
msabramo / get-serial-number.exp
Created Sep 30, 2017
Script to get the serial number of a Mac OS computer
View get-serial-number.exp
#!/usr/bin/expect -f
# Script to get the serial number of a Mac
set timeout 10
log_user 0
spawn /bin/sh -c "ioreg -rac IOPlatformExpertDevice | xpath 'plist/array/dict/key\[.=\"IOPlatformSerialNumber\"\]/following-sibling::*\[position()=1\]/text()' 2>/dev/null"
expect eof
set serial $expect_out(buffer)
puts $serial
msabramo /
Created Jul 8, 2016
Proving my identity for

Keybase proof

I hereby claim:

  • I am msabramo on github.
  • I am msabramo ( on keybase.
  • I have a public key ASAlHNkORhOLjfgneM_MPvQgkgP-7nodqWEmFfgrpL85tQo

To claim this, I am signing this object:

msabramo /
Created Sep 11, 2015
Mock patch multiple targets in Python
def multiple_targets(mock_patches):
`mock_patches` is a list (or iterable) of mock.patch objects
Example usage:
with mock.patch.multiple_targets([
mock.patch('os.path.exists', side_effect=mock_path_exists),
msabramo /
Created Sep 11, 2015
A Python context manager for doing multiple mock.patches
def multiple_mocks(mock_specs):
`mock_specs` is a dict of mock target name => mock patch kwargs
Example usage:
with multiple_mocks(
{'os.path.exists': {'side_effect': mock_path_exists},
'subprocess.Popen': {},
msabramo /
Last active Aug 29, 2015 — forked from dtrapezoid/
Becoming Friends with Cassandra Workshop Instructions

Instructions for "Becoming Friends with Cassandra"

Go here:

Where do I start?

To start communicating with Cassandra like a champ, Cassandra's Query Language (CQL) is your best bet. CQL is an SQL-like language, which makes it warm and fuzzy for those of us used to SQL, but don't let that fool you...

We still have to think about how we "converse" with Cassandra differently. When we model our data, we need to think about how we will access it before we model it. It's important to emphasize this point, because you can get into some very ugly territory if you model Cassandra like a relational database. Data Modeling with Cassandra is purely query-driven.

import os
FIELDS = os.environ.get('ANSIBLE_HUMAN_LOG_FIELDS').split(',')
if not FIELDS:
FIELDS = ['cmd', 'command', 'start', 'end', 'delta', 'msg', 'stdout', 'stderr']
def human_log(res):
if type(res) == type(dict()):
for field in FIELDS:
View gist:05ca407f20c36da2c133
Finally, after years of improvements and fixes we got a new version
Summary of Changes in release 0.95
User visible (not in a particular order):
- Support for build with CMake under Windows.
- Support MSSQL 2008:
- new date/time types;
- able to retrieve CLR UDT types in binary format.
You can’t perform that action at this time.