This file contains hidden or 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
FROM node:7.1 | |
# Install yarn | |
RUN set -x \ | |
&& curl https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ | |
&& echo "deb http://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \ | |
&& apt-get update && apt-get install yarn | |
WORKDIR /src/app |
This file contains hidden or 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 -euo pipefail | |
print_usage() { | |
echo "usage: save.sh [-o|--output output.tar.gz] service_name" | |
} | |
main() { | |
PRINT_USAGE=0 |
This file contains hidden or 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
// See https://fsharpforfunandprofit.com/posts/function-signatures/ | |
// val testA = int -> int | |
// val testB = int -> int -> int | |
// val testC = int -> (int -> int) | |
// val testD = (int -> int) -> int | |
// val testE = int -> int -> int -> int | |
// val testF = (int -> int) -> (int -> int) | |
// val testG = int -> (int -> int) -> int | |
// val testH = (int -> int -> int) -> int |
This file contains hidden or 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
open System | |
let bigFib n = | |
let rec loop previous previousPrevious = function | |
| n when n = 0I -> previousPrevious | |
| n -> loop (previous + previousPrevious) previous (n - 1I) | |
loop 1I 0I n | |
let factorial n = | |
let rec loop acc = function |
This file contains hidden or 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
public static string BytesToString(long byteSize) | |
{ | |
const string format = "{0} {1}"; | |
const int orderBase = 1024; | |
var units = new[] {"B", "KB", "MB", "GB", "TB", "PB", "EB"}; | |
if (byteSize == 0) | |
return "0 B"; | |
var order = Convert.ToInt32(Math.Floor(Math.Log(byteSize, orderBase))); | |
var rescaledSize = Math.Round(byteSize/Math.Pow(orderBase, order), 1); |
This file contains hidden or 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
open System | |
// Tail recursive Fibonacci | |
// BigInt -> BigInt | |
let bigFib n = | |
let rec loop previous previousPrevious = function | |
| n when n = 0I -> previousPrevious | |
| n -> loop (previous + previousPrevious) previous (n - 1I) | |
loop 1I 0I n | |
This file contains hidden or 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
using System; | |
using System.Linq; | |
using System.Web.Script.Serialization; | |
using System.Windows.Forms; | |
namespace AsynchronousWebPage | |
{ | |
/// <summary> | |
/// Extension convenience methods to invoke arbitrary Javascript method on a web page | |
/// hosted by a WebBrowser control. |
This file contains hidden or 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
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace Solution | |
{ | |
class Solution | |
{ | |
static void Main(string[] args) |
This file contains hidden or 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
using System; | |
namespace Solution | |
{ | |
// Algorithm discussion at https://www.hackerrank.com/challenges/volleyball-match/editorial referenced | |
// (Not enough time to develop algorithm!) | |
class Solution | |
{ | |
public const int Modular = 1000000007; |
This file contains hidden or 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
// Credits: http://goo.gl/NtaADC | |
// Inline PTX assembly | |
uint add_asm(uint *result, const uint *a, const uint *b) { | |
uint carry; | |
asm("{\n\t" | |
"add.cc.u32 %0, %9, %17; \n\t" | |
"addc.cc.u32 %1, %10, %18; \n\t" | |
"addc.cc.u32 %2, %11, %19; \n\t" | |
"addc.cc.u32 %3, %12, %20; \n\t" |