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
//! Proof of concept for a reference counted [str] | |
//! Primary innovation over a plain Rc<str> is that is one less level of | |
//! indirection and heap allocation | |
#![feature(const_alloc_layout)] | |
use core::ptr::NonNull; | |
use std::alloc::Layout; | |
use std::alloc::{GlobalAlloc, System}; |
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 <stdbool.h> | |
#include <stddef.h> | |
#include <string.h> | |
#include <stdio.h> | |
typedef struct thing thing_t; | |
struct thing { | |
long num; | |
int cnt; |
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
"""Implements a simple expression evaluator. | |
Supported syntax: | |
1. Balanced parenthesis for grouping. | |
2. Numbers. Can include a decimal point. | |
3. Negation ('-' as a prefix unary operator) | |
4. Binary operators for '*', '/', '+', and '-'. | |
Order of operations follow typical rules: | |
1. Grouping. (1+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
namespace Collections | |
module RiderReproTests = | |
open FsCheck.Xunit | |
open Xunit | |
[<Property>] | |
let repro_test_pass (_:int) = true |
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
section .text | |
global _start | |
_start: | |
mov rdi, 42 | |
mov rax, 60 ; sys_exit | |
syscall | |
; assemble the elf64 object file with nasm: |
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
import org.apache.hadoop.conf.Configuration | |
import org.apache.hadoop.io.{LongWritable, Text} | |
import org.apache.hadoop.mapreduce.lib.input.{FileSplit, TextInputFormat} | |
import org.apache.spark.{SparkConf, SparkContext} | |
import org.apache.spark.rdd.NewHadoopRDD | |
object Program { | |
def main(args: Array[String]): Unit = { | |
val srcFile = "hdfs://sandbox/Numbers.txt" | |
val conf = new SparkConf().setAppName("spark-numbers") |
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
(ns biblecli.commands.serve | |
(:require | |
[cljs.nodejs :as nodejs] | |
[clojure.string :as string] | |
[goog.object])) | |
(def node-http (nodejs/require "http")) | |
(defn process-request [req res] | |
(goog.object/set res "statusCode" 200) |
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
$ErrorActionPreference = "Stop" | |
$root = Resolve-Path "$PSScriptRoot\.." | |
$shell = New-Object -com shell.application | |
# Read white listed dependency version info from the /bin/sh script and store in variables | |
Get-Content $root\script\bootstrap | | |
Where-Object { $_ -match '^\s*(\w+)\s*=\s*\"([^\"]*)\"\s*$' } | | |
Where-Object { $matches[1] -in "CLOJURE_RELEASE", "CLOSURE_RELEASE", | |
"DJSON_RELEASE", "GCLOSURE_LIB_RELEASE", "RHINO_RELEASE", "TREADER_RELEASE" } | | |
Foreach-Object { New-Variable $matches[1] $matches[2] -Scope private } |
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
;; Solution to https://github.com/gigasquid/wonderland-clojure-katas/tree/master/alphabet-cipher | |
(ns alphabet-cipher.coder) | |
(defn crypt [op keyword message] | |
(letfn [ | |
(tochar [idx] (char (+ idx (int \a)))) | |
(toidx [ch] (- (int ch) (int \a))) | |
(encode [keychar msgchar] (tochar (mod (op (toidx msgchar) (toidx keychar)) 26)))] | |
(->> message | |
(map encode (cycle keyword)) |
NewerOlder