Skip to content

Instantly share code, notes, and snippets.

View darked89's full-sized avatar

Darek Kedra darked89

  • Barcelona, Spain
View GitHub Profile
@tylermorganwall
tylermorganwall / ripple.R
Created November 22, 2019 12:35
Pathtraced ripple effect in R with rayshader/rayrender
library(rayshader)
wave = matrix(0,200,200)
for(t in seq(1,360,1)) {
for(i in 1:200) {
for(j in 1:200) {
wave[i,j] = 50*sinpi(sqrt((i-100)^2 + (j-100)^2)/30-t/180) * exp(-(sqrt((i-100)^2 + (j-100)^2))/100)
}
}
wave %>% height_shade() %>% plot_3d(wave, soliddepth = -50, shadowdepth = -70, theta=315,zoom=1.1)
@Zate
Zate / freeze.md
Created July 25, 2018 10:25 — forked from jessfraz/freeze.md

In a terminal start a server.

$ python -m SimpleHTTPServer 8000

In another terminal set up the cgroups freezer.

@shahril96
shahril96 / garden_puzzle_z3.py
Created May 28, 2017 23:41
Using Z3 Theorem Solver to solve for Gardens Puzzle
import sys
import itertools
from z3 import *
#
# Original puzzle
#
'''
Five friends have their gardens next to one another, where they grow three kinds of crops:
@danielecook
danielecook / callNimFromR.org
Created March 11, 2019 11:39 — forked from Vindaar/callNimFromR.org
How to call Nim code from R using `.C` interface

Calling Nim from R

A super short introduction how to call Nim code from R using the .C interface. I’m not an R user normally, so I googled and used this post as a reference: https://www.r-bloggers.com/three-ways-to-call-cc-from-r/

Writing our Nim procedure

Let’s define a simple procedure, which we want Nim to do:

@sinkingsugar
sinkingsugar / halide.nim
Created July 2, 2019 05:52
Nim and Haldie
import nimline
import os
static:
let
halideDist = getenv("HALIDE_DIST")
assert halideDist != "" , "HALIDE_DIST environment variables not set!"
when defined windows:
@sinkingsugar
sinkingsugar / Dockerfile
Created February 20, 2019 08:51
Pytorch build
FROM nvidia/cuda:10.0-cudnn7-devel-ubuntu18.04
RUN apt-get update && apt-get install -y build-essential git cmake python3-pip libmpfr-dev libgmp-dev wget curl
RUN pip3 install pyyaml
RUN pip3 install typing
RUN cd && \
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
@tdhopper
tdhopper / .editorconfig
Last active July 21, 2022 12:52
Configuration files to enable validating python code with flake8, mypy, isort, and black using pre-commit hooks (via https://pre-commit.com/). Also an .editorconfig file for standardization across editors.
# http://editorconfig.org/#file-format-details
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
@arsperger
arsperger / redis_import_csv.txt
Created September 12, 2017 11:38
import csv file into redis with a single command
cat data.csv | awk -F',' '{print " SET \""$1"\" \""$2"\" \n"}' | redis-cli --pipe
@joshlk
joshlk / faster_toPandas.py
Last active May 15, 2023 13:48
PySpark faster toPandas using mapPartitions
import pandas as pd
def _map_to_pandas(rdds):
""" Needs to be here due to pickling issues """
return [pd.DataFrame(list(rdds))]
def toPandas(df, n_partitions=None):
"""
Returns the contents of `df` as a local `pandas.DataFrame` in a speedy fashion. The DataFrame is
repartitioned if `n_partitions` is passed.
@wbazant
wbazant / R-package-with-singularity.md
Last active April 3, 2024 14:00
Singularity container for an R module on a research cluster

Singularity container for an R module on a research cluster for VEuPathDB

Introduction

To use this technology, we need Singularity installed in the target environment by root, which is possibly the largest obstacle for us.

Writing a development container

Here is a container for analysing 16s rRNA data in MicrobiomeDB, requiring an R package DADA2. DADA2 releases to BioConductor, but we want the ability to load an arbitrary commit for development.

We can build on somebody's container with r-devtools, and add our libraries: