Skip to content

Instantly share code, notes, and snippets.

View gist:bf554c4eb6d75837c00b4ec01991da05
1. Install msys2 from msys2.org
2. run msys2.exe: pacman -Syu, restart, pacman -Su
3. run mingw64.exe: pamcan -S mingw-w64-x86_64-emacs
4. create C:\msys64\runemacs_patched_path.bat:
cmd /C "set PATH=c:\msys64\mingw64\bin;c:\msys64\usr\bin;%PATH% && C:\msys64\mingw64\bin\runemacs.exe --daemon"
5. Super-R shell:startup [RET]
6. Create shortcut to runemacs_patched_path.bat, call it e.g. "emacs-daemon"
7. Create a short-cut in Start menu:
C:\msys2_64\mingw64\bin\emacsclientw.exe -c -n -a "C:\msys2_64\mingw64\bin\runemacs.exe"
View docker_symengine_cos6.sh
#!/bin/bash
# This script uses docker to build a specific symengine commit under CentOS6/GCC8/boost1.72
#
# Example usage:
#
# $ sudo ./docker_symengine_cos6.sh e7d7ae55f4fd6740a48acaea0e7e24542ceda6b7
#
if ! which docker; then
2>&1 echo "You need to have docker installed. See e.g. https://www.docker.com/community-edition#/download"
View mny.py
import math
import datetime
from functools import reduce
MÅNADER_PER_ÅR = 12
DAGAR_PER_ÅR = 365.25
DAGAR_PER_MÅNAD = DAGAR_PER_ÅR / MÅNADER_PER_ÅR
def årlig_tillväxt_i_procent_uttryckt_som_faktor_per_månad(x_procent):
# y**12 == 1 + årlig_aktie_avkastning_procent/100
# log(y) = log(1 + årlig_aktie_avkastning_procent/100)/12
@bjodah
bjodah / .gitignore
Last active Mar 22, 2020
Script to compile symengine with memory sanitizer enabled.
View .gitignore
mount_*/
environment_*/
View _scal.cpp
#include <pybind11/pybind11.h>
#include <pybind11/numpy.h>
#include <numpy/arrayobject.h>
namespace py = pybind11;
template<typename T>
py::object create_numpy_scalar(T val) {
// usage requires initialized NumPy C-API (call _imoprt_array() before use)
py::object dt = py::dtype::of<T>();
@bjodah
bjodah / test_repo.sh
Created Jul 17, 2018
Convenience script for use with drone (v0.4) cli (http://readme.drone.io/0.4/devs/cli/)
View test_repo.sh
#!/bin/bash -uex
# usage:
#
# $ sudo ./test_repo.sh pycvodes/
#
# $ sudo ./test_repo.sh pynleq2 -e PYNLEQ2_NLEQ2_ROOT_URL=http://secret.example.com/nleq2/
#
# Depends on drone CLI client:
#
# http://readme.drone.io/0.4/devs/cli/
@bjodah
bjodah / gist:a0a7bf852ed4a5743d9127ea506e2698
Created Apr 4, 2018
conda inspect on conda-forge's emacs
View gist:a0a7bf852ed4a5743d9127ea506e2698
$ conda inspect linkages -n test emacs
WARNING: pyldd disagrees with ldd/otool. This will not cause any
WARNING: problems for this build, but please file a bug at:
WARNING: https://github.com/conda/conda-build
WARNING: and (if possible) attach file /home/bjorn/miniconda3/envs/test/bin/ctags
WARNING:
ldd/otool gives:
('linux-vdso.so.1', '')
('libc.so.6', '/lib/x86_64-linux-gnu/libc.so.6')
pyldd gives:
@bjodah
bjodah / echo.py
Created Feb 1, 2018
Context manager echo-ing new local variables
View echo.py
import inspect
import pprint
class Echo:
""" Context maganger for echoing variable assignments (in CPython)
Examples
--------
>>> with Echo():
... foo = 42
View enmako.py
#!/usr/bin/env python
# This file should work with both Python 2 & Python 3:
#
# $ python2 -m pytest enmako.py
# $ python3 -m pytest enmako.py
import io
import argh
from mako.template import Template
View calc_powers.cpp
#include "header.hpp"
#include <stdlib.h>
#include <vector>
using namespace std;
namespace ops {
Powers :: Powers() {}
Powers::~Powers() {}
You can’t perform that action at this time.