Skip to content

Instantly share code, notes, and snippets.

View apahl's full-sized avatar

Axel Pahl apahl

  • MPI of Molecular Physiology (Dortmund)
  • Germany, Dortmund (work) / Hannover (home)
  • 00:02 (UTC +02:00)
  • Mastodon @apahl@fosstodon.org
View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@apahl
apahl / test_smiles.cpp
Created October 9, 2017 11:53
test_smiles.cpp
/* Generated by Nim Compiler v0.17.3 */
/* (c) 2017 Andreas Rumpf */
/* The generated code is subject to the original license. */
/* Compiled for: Linux, amd64, gcc */
/* Command for C compiler:
g++ -c -w -w -fpermissive -D_GLIBCXX_USE_CXX11_ABI=0 -I/home/pahl/progs/nim/lib -I/home/pahl/dev/github/rdkit/Code/ -o /home/pahl/dev/nim/rdkit/nimcache/test_smiles.o /home/pahl/dev/nim/rdkit/nimcache/test_smiles.cpp */
#define NIM_NEW_MANGLING_RULES
#define NIM_INTBITS 64
#include "nimbase.h"
@apahl
apahl / nim_magic.py
Last active October 21, 2019 13:53
Nim cell magic for Jupyter and JLab Notebooks
"""
nim_magic.py
Jupyter cell magic for your favorite programming language.
This is now also available as a proper repo:
https://github.com/apahl/nim_magic
All further changes will be tracked there.
Requirements: Nim (https://nim-lang.org), nimpy (`nimble install nimpy`, thanks to @yglukhov for this great library!)
@apahl
apahl / gist:631d13002e633372cffb3fbf48cd8385
Last active September 21, 2018 16:02
go module question
Module structure:
~/dev/go/collect
$ tree
.
├── go.mod
├── go.sum
├── LICENSE.txt
├── maps
│   ├── maps_gen.go
│   ├── maps.go
@apahl
apahl / test.nim
Created September 24, 2018 08:25
where would the Table (not TableRef) inside a `ref object` be located? Stack or heap?
import tables
type MyObj = ref object
a: int
t: Table[int, int] # where would this table be located?
when isMainModule:
var obj = MyObj(a: 1, t: {1: 1, 2: 2}.toTable)
echo obj.t
@apahl
apahl / test.nim
Created September 25, 2018 09:13
Do I have to implement a hash for my enum?
import tables
type
Element* {.pure.} = enum
invalid = (-1, "Inv"),
unknown = (0, "*"),
hydrogen = (1, "H"),
boron = (5, "B"),
carbon = (6, "C"),
nitrogen = (7, "N"),
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@apahl
apahl / iterrows.ipynb
Last active September 14, 2020 11:28
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.