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
| // Sieve of Eratosthenes | |
| def calc_primes( nums:List[Int] ):List[Int] = { | |
| nums match { | |
| case x::xs => | |
| val nums_dash = for( i <- xs if i % x != 0 ) yield i | |
| println( Runtime.getRuntime.totalMemory/1024/1024 ) | |
| x :: calc_primes( nums_dash ) | |
| case _ => Nil | |
| } | |
| } |
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
| require 'formula' | |
| class Tmux < Formula | |
| url 'http://sourceforge.net/projects/tmux/files/tmux/tmux-1.5/tmux-1.5.tar.gz' | |
| md5 '3d4b683572af34e83bc8b183a8285263' | |
| homepage 'http://tmux.sourceforge.net' | |
| depends_on 'libevent' | |
| def patches |
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
| var gulp = require('gulp'); | |
| var browserify = require('browserify'); | |
| var source = require('vinyl-source-stream'); | |
| var reactify = require('reactify'); | |
| gulp.task('build', function(){ | |
| var bundler = browserify('./app/app.js'); | |
| bundler.transform(reactify, {"es6": true}); | |
| return bundler.bundle() | |
| .pipe(source("app.js")) |
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/sh | |
| autoreconf -fi >/dev/null 2>&1 | |
| NDK_ROOT=/usr/local/opt/android-ndk | |
| curl http://www.geocities.jp/kosako3/oniguruma/archive/onig-5.9.5.tar.gz | tar xz | |
| cd onig-5.9.5 | |
| # So, we need to remake the configure scripts so that the arm64 architecture |
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
| apply plugin: 'com.android.library' | |
| android { | |
| compileSdkVersion 21 | |
| buildToolsVersion "21.1.2" | |
| defaultConfig { | |
| minSdkVersion 9 | |
| targetSdkVersion 21 | |
| versionCode 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
| var marked = require(atom.packages.resourcePath + "/node_modules/marked"); | |
| marked.Renderer.prototype.heading = function(text, level, raw) { | |
| return '<h' | |
| + level | |
| + ' id="' | |
| + this.options.headerPrefix | |
| + raw.toLowerCase().replace(/[\s]+/g, '-') | |
| + '">' | |
| + text | |
| + '</h' |
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
| defmodule EctoTest.Repo do | |
| use Ecto.Repo, otp_app: :ecto_test | |
| import Ecto.Query | |
| def find_or_create_by(queryable, attrs) do | |
| q = Enum.reduce(attrs, queryable, fn | |
| {field, val}, query -> | |
| query |> where([x], field(x, ^field) == ^val) | |
| _, query -> query |
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
| atomic-1.1.99.gem: $CFLAGS += " -march=native" | |
| atomic-1.1.99-java.gem: $CFLAGS += " -march=native" | |
| bit-twiddle-0.0.5.gem:$CFLAGS << ' -Wall -Werror -O3 -march=native -mtune=native -std=c99 ' | |
| chruby-0.3.gem:CFLAGS := "-O3 -march=native" | |
| cityhash-0.8.1.gem:%w{g O3 Wall march=native}.each do |flag| | |
| concurrent-ruby-0.7.2-x64-mingw32.gem: $CFLAGS += " -march=native" | |
| concurrent-ruby-0.7.2-x86_64-linux.gem: $CFLAGS += " -march=native" | |
| concurrent-ruby-0.7.2-x86-linux.gem: $CFLAGS += " -march=native" | |
| concurrent-ruby-0.7.2-x86-mingw32.gem: $CFLAGS += " -march=native" | |
| concurrent-ruby-0.7.2-x86-solaris-2.11.gem: $CFLAGS += " -march=native" |
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
| HOST_IP=$(curl -s 169.254.169.254/latest/meta-data/local-ipv4) | |
| TASKS_JSON=$(curl -s $HOST_IP:51678/v1/tasks) | |
| CONTAINER_ID=$(cat /proc/self/cgroup | grep "cpu:/" | sed 's/.*cpu:\/docker\///g') | |
| TASK_ID=$(echo $TASKS_JSON|jq -r ".Tasks[] | select(.Containers[].DockerId == \"$CONTAINER_ID\") | .Arn"|sed 's/.*task\///') | |
| TASK_FAMILY=$(echo $TASKS_JSON|jq -r ".Tasks[] | select(.Containers[].DockerId == \"$CONTAINER_ID\") | .Family") |
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
| #[macro_use] | |
| extern crate nom; | |
| use nom::*; | |
| fn take_digits_n(input: &[u8], n: u8) -> IResult<&[u8],&[u8]> { | |
| verify!(input, take!(n), |chars: &[u8]| chars.iter().all(|c: &u8| is_digit(*c)) ) | |
| } | |
| named!(take_4_digits, apply!(take_digits_n, 4)); | |
| named!(take_1_or_2_digits, alt_complete!( apply!(take_digits_n, 2) | apply!(take_digits_n, 1)) ); |
OlderNewer