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
# frozen_string_literal: true | |
source 'https://rubygems.org' | |
gem 'ffi' |
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
# code modified from https://github.com/nelsonic/coin-change-ruby | |
class Change | |
def change(amount, available_coins = [100, 50, 25, 10, 5, 1]) | |
@available_coins = available_coins | |
smallest = @available_coins.min | |
zeros = [0] * @available_coins.size | |
solutions = (0...@available_coins.size).map { |n| k = zeros.dup; k[n] = 1; k } | |
vectors = solutions.dup | |
visited = Hash[solutions.map { |v| [v, true] }] |
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
version: '3' | |
services: | |
db: | |
image: postgres:10.4-alpine | |
ports: | |
- 5432:5432 | |
volumes: | |
- postgres:/var/lib/postgresql/data | |
redis: | |
image: redis:4.0-alpine |
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
pragma solidity ^0.4.11; | |
contract AddressStore { | |
address[] public bought; | |
address public selected; | |
function sb(uint256 _index) public returns (address){ | |
uint256 i = _index; | |
selected = bought[i]; | |
return selected; |
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
eval "$(rbenv init -)" | |
export EDITOR=vim | |
LOG_COMMAND='if [ "$(id -u)" -ne 0 ]; then echo "$(date "+%Y-%m-%d.%H:%M:%S") $(pwd) $(history 1)" >> ~/.logs/bash-history-$(date "+%Y-%m-%d").log; fi' | |
if [ -z "${PROMPT_COMMAND}" ]; then | |
export PROMPT_COMMAND=${LOG_COMMAND} | |
else | |
export PROMPT_COMMAND="${PROMPT_COMMAND}; ${LOG_COMMAND}" | |
fi | |
export CLICOLOR=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
Sys.setenv('SPARKR_SUBMIT_ARGS'='"--packages" "com.databricks:spark-csv_2.11:1.2.0" "sparkr-shell"') | |
library(SparkR, lib.loc = "/home/user1/programs/spark-2.2.0-bin-hadoop2.7/R/lib/") | |
sc <- sparkR.session(master = "local", appName="myapp", sparkHome = "/home/ubuntu/programs/spark-2.2.0-bin-hadoop2.7", | |
sparkConfig=list(spark.executor.memory="6g", spark.driver.memory="12g")) | |
df <- collect(read.parquet("big/parquet/file1")) | |
sparkR.stop() |
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 continuumio/miniconda3 | |
ENTRYPOINT [ "/bin/bash", "-c" ] | |
ADD . /deps | |
WORKDIR /deps | |
RUN conda install --yes --file req.txt | |
CMD ["source activate dask && dask-scheduler"] |
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
<configuration> | |
<property> | |
<name>fs.s3a.access.key</name> | |
<value>ACCESSKEY</value> | |
</property> | |
<property> | |
<name>fs.s3a.secret.key</name> | |
<value>SecretKey</value> |
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
library(rbenchmark) | |
library(data.table) | |
n <- 100000 | |
f <- sample(c("a","b","c"),n, replace=TRUE) | |
a <- data.table(a=runif(n,0,100),b=runif(n,0,100),f=f) | |
setindex(a,"a") | |
setindex(a,"b") | |
setindex(a,"f") | |
op = options(datatable.verbose=FALSE) |
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
--- | |
- hosts: all | |
connection: local | |
tasks: | |
- name: check | |
local_action: debug msg={{ item.name }} | |
with_items: | |
- "{{ files }}" | |
- name: register data |
NewerOlder