Skip to content

Instantly share code, notes, and snippets.

View goldshtn's full-sized avatar

Sasha Goldshtein goldshtn

View GitHub Profile
@goldshtn
goldshtn / lab1.md
Last active August 29, 2015 14:09
iOS Lab 1

In this lab, you will experiment with Objective C fundamentals in a Mac terminal application that does not display any user interface. Everything you do in this lab is applicable to iOS as well – we will not use any API that is not available in iOS.

Begin by creating an Xcode project of type OS X > Application > Command Line Tool. (In the Type combo box, select “Foundation” if it isn’t selected.) Add classes as necessary per the instructions below using File > New > File, OS X > Cocoa > Objective C Class.

Implement a PlayingCard class that has the following methods, initializers, and properties:

  • NSString* suit property
  • NSUInteger rank property (valid values are 1-13, where 1 = “Ace”, …, 13 = “King”)
  • NSString* contents read-only property that returns the card name (e.g. “Jack of Spades”)
@goldshtn
goldshtn / installations.md
Last active August 29, 2015 14:08
BuildStuffLT 2014 - .NET Debugging Workshop Installation Requirements

.NET Debugging Workshop installation requirements

Please have the following software installed on your laptop prior to coming to the workshop. Downloading this software during the day might prove problematic because of the large file sizes and the network speed. Thank you!

Additionally, the labs we will use during the workshop are available here. Please download and extract the files before the workshop.

If you have any questions about the above installation instructions, please contact the instructor, Sasha Goldshtein.

@goldshtn
goldshtn / main.cpp
Created July 17, 2014 06:42
Demo app for experimenting with WinDbg. Compile with Visual C++ 2013.
#include <Windows.h>
#include <vector>
#include <iostream>
#include <thread>
#include <random>
class DynamicArray
{
char* data_;
unsigned len_;
@goldshtn
goldshtn / non-paged-pool-leak.cpp
Created February 16, 2014 11:04
Non-Paged Pool Leak
#include <Windows.h>
#include <Psapi.h>
#include <string>
#include <iostream>
void VERIFY(bool condition, std::string message)
{
if (!condition)
{
@goldshtn
goldshtn / bad-metadata.cs
Created January 20, 2014 14:11
An example of a WCF service that causes metadata publishing to fail such that "Add Service Reference" reports a cryptic failure.
[ServiceContract]
interface IChatClient
{
[OperationContract(IsOneWay = true)]
void Message(string message);
}
[ServiceContract(CallbackContract = typeof(IChatClient))]
interface IChatService
{
@goldshtn
goldshtn / cpp11.cpp
Last active May 8, 2018 01:24
A single function that uses a bunch of C++11/14 features and for "old-school" C++ developers will not even read like C++ anymore.Specifically, it uses:- lambda functions (C++11) with generalized capture semantics (C++14)- rvalue references (C++11)- auto variables (C++11)- decltype and trailing function return type syntax (C++11)- std::move and s…
#include <iostream>
#include <future>
using namespace std;
template <typename Fn, typename... Args>
auto do_async_with_log(ostream& os, Fn&& fn, Args&&... args) ->
future<decltype(fn(args...))>
{
os << "[TID=" << this_thread::get_id()
@goldshtn
goldshtn / primes-parallelization.cpp
Created October 23, 2013 15:18
Benchmark for parallelizing work unevenly across multiple threads.
#include <chrono>
#include <thread>
#include <iostream>
#include <cmath>
#include <vector>
#include <functional>
#include <algorithm>
template <typename Fn>
double avg_time_ms(Fn&& fn, unsigned int repetitions) {
@goldshtn
goldshtn / stackalloc-benchmark.cs
Created October 17, 2013 09:03
Benchmark for comparing stackalloc to heap allocations for small, medium, and large arrays.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StackAllocVsHeapAlloc
{
public static class Sandbox