Skip to content

Instantly share code, notes, and snippets.

@Foat
Foat / conda.conf
Created May 17, 2022 07:38 — forked from ei-grad/conda.conf
Nginx caching proxy for conda
# /etc/nginx/conf.d/conda.conf
proxy_cache_path /var/cache/nginx/conda levels=2:2 keys_zone=conda:100m inactive=14d max_size=10g;
upstream conda.anaconda.org {
server 104.17.92.24:443;
server 104.17.93.24:443;
}
server {
listen 80;
@Foat
Foat / entry.sh
Created May 12, 2022 14:04 — forked from xkortex/entry.sh
dockerfile entrypoint for activating conda environment
#!/bin/bash
## Entrypoint for docker RUN directives as well as ENTRYPOINT with conda env
## Enable by adding:
## COPY entry.sh ./
## SHELL ["/entry.sh", "/bin/bash", "-c"]
##
## Optionally, set the following env to select a conda env to run in
## ENV CONDA_DEFAULT_ENV=foo
## You may also want to add something like
## RUN conda init bash && echo 'conda activate "${CONDA_TARGET_ENV:-base}"' >> ~/.bashrc
@Foat
Foat / remove_old_builds.sql
Created May 11, 2022 17:49 — forked from david-zw-liu/remove_old_builds.sql
Keep 1000 builds per repos for DroneCI (sqlite3 version >= 3.25 required)
-- Thank @sbengo to figure out foreign_keys constraints is defaults to false in sqlite
-- Enable to delete logs by cascading delete
PRAGMA foreign_keys = ON;
WITH n_build_ids_per_repo as (
SELECT build_id
FROM (
SELECT
build_id,
build_repo_id,
@Foat
Foat / Insert.scala
Created December 15, 2018 07:08 — forked from fancellu/Insert.scala
Simple insertion into an ordered List
val li=List(1,2,10,20,30) //> li : List[Int] = List(1, 2, 10, 20, 30)
def insert[T](li:List[T],x:T)(implicit cmp:Ordering[T])={
val (first,last)=li.partition {cmp.lteq(_, x) }
first:::x::last
} //> insert: [T](li: List[T], x: T)(implicit cmp: Ordering[T])List[T]
insert(li,11) //> res0: List[Int] = List(1, 2, 10, 11, 20, 30)
insert(li,10) //> res1: List[Int] = List(1, 2, 10, 10, 20, 30)
insert(li,9) //> res2: List[Int] = List(1, 2, 9, 10, 20, 30)