This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -x | |
set -e | |
# Retries a command a with backoff. | |
# | |
# The retry count is given by ATTEMPTS (default 10), the | |
# initial backoff timeout is given by TIMEOUT in seconds | |
# (default 5.) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bytes" | |
"fmt" | |
"io/ioutil" | |
"crypto/sha256" | |
"encoding/hex" | |
"github.com/heroku/docker-registry-client/registry" | |
"github.com/docker/distribution/digest" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <unordered_map> | |
#include <iostream> | |
void printArray(int ar[], int high) | |
{ | |
for (int i = 0; i < high; ++i) | |
{ | |
std::cout << ar[i] << "\t"; | |
} | |
std::cout << std::endl; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <vector> | |
#include <iostream> | |
#include <algorithm> | |
void printArray(int ar[],int high) | |
{ | |
for (int i = 0; i < high; ++i) | |
{ | |
std::cout << ar[i] << "\t"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
int binarySearch(int ar[], int low, int high, int search) | |
{ | |
if (low > high) | |
return -1; | |
int mid = (low + high) / 2; | |
if (ar[mid] < search) | |
{ | |
return binarySearch(ar, mid+1, high, search); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
int partition(int ar[], int low, int high) | |
{ | |
int pivot = ar[(low + high) / 2]; | |
while (low <= high) | |
{ | |
while (ar[low] < pivot) low++; | |
while (ar[high] > pivot) high--; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <vector> | |
#include <iostream> | |
#include <math.h> | |
#include <list> | |
#include <map> | |
#include <unordered_map> | |
std::vector<int> prime_vct; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <vector> | |
#include <iostream> | |
#include <algorithm> | |
bool compare(int a, int b) | |
{ | |
return (a > b); | |
} | |
void sort(std::vector<int> &ar) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <vector> | |
#include <iostream> | |
#include <math.h> | |
void primeGenerator(std::vector<int> &prime_vct, unsigned int maxPrime) | |
{ | |
prime_vct.push_back(1); | |
prime_vct.push_back(2); | |
for (unsigned int i = 3; i < maxPrime; i += 2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <Windows.h> | |
long long milliseconds_now() { | |
static LARGE_INTEGER s_frequency; | |
static BOOL s_use_qpc = QueryPerformanceFrequency(&s_frequency); | |
if (s_use_qpc) { | |
LARGE_INTEGER now; | |
QueryPerformanceCounter(&now); | |
return (1000LL * now.QuadPart) / s_frequency.QuadPart; |
NewerOlder