This file contains 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
local setup_x() = { | |
before_script: ['echo hi'], | |
}; | |
local build(build_args) = | |
{ | |
script: [ | |
'docker build ' + std.join(' ', ['--build-arg ' + b for b in build_args]), | |
], | |
}; |
This file contains 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
class A(Base, TableRepr): | |
__tablename__ = "a" | |
__mapper_args__ = dict( | |
polymorphic_on="type", | |
polymorphic_identity="a", | |
) | |
id = Column(Integer, primary_key=True) | |
x = Column(String) |
This file contains 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
class Config(Base, TableRepr): | |
__tablename__ = "config" | |
id = Column(Integer, primary_key=True, index=True) | |
sub_config_id = Column(Integer, ForeignKey("subconfig.id")) | |
sub_config = relationship( | |
"SubConfig", cascade="all, delete-orphan", single_parent=True | |
) | |
class SubConfig(Base, TableRepr): |
This file contains 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
class M: | |
def __init_subclass__(cls): | |
base_configs = {} | |
for base in cls.__bases__: | |
if hasattr(base, "_config"): | |
base_configs |= base._config | |
_cls_config = cls.__dict__.get("_config", {}) | |
cls._config = base_configs | _cls_config |
This file contains 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
insert_val <- function(x) { | |
x_ser <- serialize(x, NULL, ascii = TRUE) %>% | |
cat() %>% | |
capture.output() | |
tempfile_name <- paste0(tempfile(), ".R") | |
print(tempfile_name) | |
file <- file(tempfile_name) | |
writeLines( | |
c( |
This file contains 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(magrittr) | |
# call R in a separate process and yield the serialized result | |
# to the outer R process | |
return_val <- function() { | |
result <- system2( | |
"R", | |
c( | |
"-q", "-s", | |
"-e", "'library(magrittr)'", |
This file contains 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
import numba | |
import numpy as np | |
import timeit | |
def pot1(dist, charge): | |
return charge / dist | |
@numba.njit |
This file contains 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
import numpy as np | |
import timeit | |
def pot1(dist, charge): | |
return charge / dist | |
def broadcast_old(grid, coord, charge): | |
dist = ( |
This file contains 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
[Unit] | |
Description=Blabla | |
After=network.target | |
[Service] | |
Type=simple | |
WorkingDirectory=/home/user/dir | |
ExecStart=/home/user/bin/python bla.py | |
Restart=on-failure |
This file contains 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
#!/usr/bin/env python3 | |
import os | |
import sys | |
import argparse | |
import json | |
def contained_tags(list_of_tags, cell): | |
if "tags" not in cell["metadata"]: | |
return [] |
NewerOlder