Skip to content

Instantly share code, notes, and snippets.

@aebrahim
aebrahim / firebase_login_token.py
Created March 23, 2022 20:03
Script to generate a firebase login token for testing.
#!/usr/bin/env python
"""Script to get firebase bearer token.
This requires the GOOGLE_APPLICATION_CREDENTIALS environmental variable to be
set to a valid service account credential. This is usually done by the
`gcloud auth activate-service-account` command with a JSON key file. This
account will need the iam.serviceAccounts.signBlob permission, which can be
granted by the Service Account Token Creator role.
SPDX-License-Identifier: Apache-2.0
@aebrahim
aebrahim / openmrs_api_demo.py
Created January 3, 2019 10:57
This script demonstrates an OpenMRS login followed by a REST API call.
#!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0
import base64
import urllib.request
import json
# Documentation of OpenMRS API here:
# https://wiki.openmrs.org/display/docs/REST+Web+Services+API+For+Clients
@aebrahim
aebrahim / gdyndns@.service
Last active October 24, 2021 17:21
A systemd service to register with a dyndns Google domain.
# A systemd service to register with a dyndns Google domain.
# SPDX-License-Identifier: Apache-2.0
# Too cheap to pay for a constant static IP for your ephemeral working box?
# This service interacts with the Google Domains dynamic DNS API to register
# on boot.
#
# Setup instrucionts
# 1. See https://support.google.com/domains/answer/6147083 to setup Google
# domain for dyndns and obtain the username and password. Note that these
from lxml.etree import parse, Element, SubElement, \
ElementTree, register_namespace, ParseError, XPath, \
XMLParser
from cobra.io.sbml3 import namespaces, strnum, ns
def add_in_flux_bounds(filename, outfile=None, min_value=-1000,
max_value=1000):
if outfile is None or outfile == "":
@aebrahim
aebrahim / daq_plotter.py
Created December 26, 2015 23:03
GUI application to control and log voltages/currents from a custom potentiostat using a DAQ from National Instruments (NI USB-6008)
import os
import wx
import time
import ctypes
import matplotlib
matplotlib.use('WXAgg')
from matplotlib.figure import Figure
from matplotlib.backends.backend_wx import _load_bitmap
from matplotlib.backends.backend_wxagg import \
FigureCanvasWxAgg as FigCanvas, \
make scipoptlib SHARED=true ZLIB=false READLINE=false GMP=false VERBOSE=true
# now run ar cs with the obj files in the previous command
ar d lib/libscipopt.a libscipopt-3.2.0.linux.x86_64.gnu.opt.so
# need to make sure linking occurs with g++ to use this
First, checkout the 1.6 code.
Copy the spxdefines.h over to src
make SHARED=true GMP=true ZLIB=false VERBOSE=true
ar crs libsoplex.a obj/*/lib/*
Then in soplex16_mods (will need to adjust paths)
g++ -Wno-main -shared -Wl,-soname,soplex_1.6_lib.so -DWITH_LONG_DOUBLE -o soplex_1.6_lib.so -fPIC soplexmain_python_callable_basis_read_write.cpp -lsoplex -L/home/aebrahim/soplex -I/home/aebrahim/soplex/src
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
export CBC_SOURCE_DIR=$HOME/build/Cbc-2.9.5
export CYLP_SOURCE_DIR=$HOME/CyLP
export COIN_INSTALL_DIR=$CBC_SOURCE_DIR/COIN_INSTALL
# first build cbc
cd $CBC_SOURCE_DIR
./configure --enable-static --with-gnu-ld --with-pic --prefix=$COIN_INSTALL_DIR
make install