Skip to content

Instantly share code, notes, and snippets.

View mhib's full-sized avatar

Marcin Henryk Bartkowiak mhib

View GitHub Profile
it "should always store a sorted collection" do
array = SortedContainers::SortedArray.new
ops = [[:push, 9199], [:push, 267], [:push, 5251], [:push, 11_014], [:push, 6240], [:push, 1178], [:push, 1477],
[:push, 5926], [:push, 4273], [:push, 7420], [:push, 1545], [:push, 6618], [:push, 7207], [:push, 9030], [:push, 5611], [:push, 14_699], [:push, 1880], [:push, 629], [:push, 4777], [:push, 6926], [:push, 10_416], [:push, 3953], [:push, 3922], [:push, 848], [:push, 6608], [:push, 5264], [:push, 1281], [:push, 2731], [:push, 2515], [:push, 1478], [:push, 7795], [:push, 4600], [:push, 11_893], [:push, 3544], [:push, 8623], [:push, 9270], [:push, 954], [:push, 13_630], [:push, 5482], [:push, 3402], [:push, 361], [:push, 10_718], [:push, 1458], [:push, 6972], [:push, 11_857], [:push, 6746], [:push, 6372], [:push, 7877], [:push, 13_944], [:push, 622], [:push, 7291], [:push, 10_186], [:push, 2607], [:push, 4126], [:push, 3377], [:push, 576], [:push, 10_244], [:push, 8447], [:push, 2103],
unsigned md3 = (dir >> k) & 3;
int i_bias = (md3 == 0) * (i > 0) * (-1) + (md3 == 1) * (i < n-1);
int j_bias = (md3 == 2) * (j > 0) * (-1) + (md3 == 3) * (j < n-1);
i += i_bias;
j += j_bias;
unsigned md3 = (dir >> k) & 3;
int i_bias = (md3 == 0) * (i > 0) * (-1) + (md3 == 1) * (i < n-1);
int j_bias = (md3 == 2) * (j > 0) * (-1) + (md3 == 3) * (j < n-1);
i += i_bias;
j += j_bias;
2
4
1 2
2 3
3 4
1 2
1 3
1 4
2
1 2
#!/usr/bin/sudo sh
## ruby_revealer.sh -- decrypt obfuscated GHE .rb files. 2.0.0 to 2.3.1+.
## From `strings ruby_concealer.so`:
##
## > This obfuscation is intended to discourage GitHub Enterprise customers
## > from making modifications to the VM.
##
## Well, good, as long as its not intended to discourage *me* from doing this!
@mhib
mhib / main.c
Last active September 17, 2015 10:59 — forked from barrysteyn/main.c
Merge sort example in C/C++
#include<iostream>
#include "mergesort.c"
using namespace std;
int main(int argc, char** argv) {
int num;
cout << "How many numbers do you want to sort: ";
cin >> num;
int a[num];
for (int i = 0; i < num; i++) {
@mhib
mhib / The Technical Interview Cheat Sheet.md
Last active September 6, 2015 07:46 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.