Skip to content

Instantly share code, notes, and snippets.

@marchelbling
marchelbling / spec1.rb
Created October 4, 2012 19:58 — forked from cheeyeo/spec1.rb
Example on how to mock out an API call using RSpec and EM:Http
before :each do
@url = 'http://sns.us-east-1.amazonaws.com:80/?Action=ListTopics&Signature=ItTAjeexIPC43pHMZLCL7utnpK8j8AbTUZ3KGUSMzNc%3D&AWSAccessKeyId=123456&Timestamp=123&SignatureVersion=2&SignatureMethod=HmacSHA256'
EventMachine::MockHttpRequest.reset_registry!
EventMachine::MockHttpRequest.reset_counts!
EventMachine::MockHttpRequest.pass_through_requests = false #set to false to not hit the actual API endpoint
end
it 'should be able to access the API endpoint' do
  • addpart: Informs the Linux kernel of new partition
  • agetty: Alternative Linux getty; handles tty, login, shell
  • arch: print machine architecture
  • blkid: Locate/print block device attributes
  • blockdev: Call block device ioctls from the command line
  • cal: Displays a calendar
  • cfdisk: Curses based disk partition table manipulator
  • chcpu: Configure CPUs
  • chfn: Change your finger information
  • chkdupexe: Find duplicate executables
@marchelbling
marchelbling / objectcoercion.cpp
Created August 17, 2012 11:34
Object coercion flow in C++
#include <iostream>
class B;
class A
{
public:
A ()
{ std::cout << "A::A ()" << std::endl; }
@marchelbling
marchelbling / stringcompress.cpp
Created August 17, 2012 11:31
simple string compressor
//examples:
// compress("AABBBCCCCCAADDDD") == "2A3B5C2A4D"
// compress("PPPQRRRSTTQQS") == "3PQ3RS2T2QS"
// compress("uvw") == "uvw"
#include<sstream>
#include<string>
void _format(std::ostringstream& out, size_t counter, char current)
{
@marchelbling
marchelbling / constness.cpp
Created August 17, 2012 10:57
Dummy code to check that a const object attributes are const
#include <iostream>
class A
{
public:
A (int a = 0) : m_a (a)
{ }
~A ()
@marchelbling
marchelbling / selection.md
Created August 7, 2015 04:03
Siggraph 2015
@marchelbling
marchelbling / docker.md
Created June 9, 2015 05:44
Docker jumpstart

Introduction

Docker is a tool for packaging and shipping apps. Based on the idea of a shipping container, it provides a standardized way for developers or system administrators to create lightweight images, or collections of images, for each element of an application, and then easily and quickly deploy the image. Since the image is standardized, it can be uniformly deployed on development or production, leading to a much simpler workflow, faster development time for the dev team, and lower management overhead for the ops team.

First, a quick overview of a few things Docker is:

  • An open source tool that places a layer on top of Linux containers (cgroups and namespaces) to make it simple to package and ship complex apps
  • A tool for creating a layered filesystem; each layer is versioned and can be shared across running instances, making for much more lightweight deployments
  • A company behind the project, as well as a site called the "Docker Hub" for sharing containers
@marchelbling
marchelbling / named_pipes.md
Created March 12, 2015 06:50
Introduction to Named Pipes

From http://www.linuxjournal.com/article/2156

A very useful Linux feature is named pipes which enable different processes to communicate.

Introduction to named pipes

One of the fundamental features that makes Linux and other Unices useful is the “pipe”. Pipes allow separate processes to communicate without having been designed explicitly to work together. This allows tools quite narrow in their function to be combined in complex ways.

A simple example of using a pipe is the command:

@marchelbling
marchelbling / essentials.md
Last active August 29, 2015 14:16
CS essentials

Data structures

list

heap

stack

queue