Skip to content

Instantly share code, notes, and snippets.

View darked89's full-sized avatar

Darek Kedra darked89

  • Barcelona, Spain
View GitHub Profile
@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.
@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:
@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
@cecilemuller
cecilemuller / 2019-https-localhost.md
Last active June 10, 2024 13:31
How to create an HTTPS certificate for localhost domains

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).

@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.

@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
@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:

@andy-thomason
andy-thomason / Genomics_A_Programmers_Guide.md
Created May 14, 2019 13:32
Genomics a programmers introduction

Genomics - A programmer's guide.

Andy Thomason is a Senior Programmer at Genomics PLC. He has been witing graphics systems, games and compilers since the '70s and specialises in code performance.

https://www.genomicsplc.com

@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:
@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)