Skip to content

Instantly share code, notes, and snippets.

View gdlmx's full-sized avatar

Mingxuan Lin gdlmx

View GitHub Profile
@gdlmx
gdlmx / Conda_condor.make
Last active August 9, 2019 13:53
HTCondor built with Python3 and Globus GSI
# Used by conda-build with the Anaconda GCC compilers:
# gcc_linux-64=7 gxx_linux-64 libgcc-ng=7
CONDAHOME?=$(CONDA_PREFIX)
GLOBUSHOME:=$(PWD)/../globus/usr
CONDORVER:=8.7.9
SRCDIR:=../condor-$(CONDORVER)
GCCROOT=$(CONDAHOME)/x86_64-conda_cos6-linux-gnu
@gdlmx
gdlmx / DAX3.py
Created October 25, 2018 15:14
Pegasus 4.8.4 Python 3
# Copyright 2010 University Of Southern California
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an "AS IS" BASIS,
@gdlmx
gdlmx / Jupyterlab_build.sh
Last active May 15, 2019 11:13
Jupyterlab admin scripts
# Build JS files for production
export NODE_OPTIONS="--max-old-space-size=4096"
jupyter-lab build --LabBuildApp.dev_build=False
@gdlmx
gdlmx / reindex_micress_vtk.py
Created June 13, 2019 13:05
Preprocessing scripts for MICRESS
import numpy as np
import re, sys
def reindex_micress_vtk(vtkfilename):
pLUT = re.compile('\s*LOOKUP_TABLE\s+', flags=re.I)
headers=[]
with open(vtkfilename) as f:
for l in f:
headers.append(l.strip())
if pLUT.match(l):
break
@gdlmx
gdlmx / CompileMTEX.sh
Last active March 9, 2020 13:50
Compile MTEX with NFFT
#!/usr/bin/bash
# https://github.com/mtex-toolbox/mtex/blob/develop/extern/nfft/readme.md
# https://github.com/mtex-toolbox/mtex/tree/develop/extern/nfft_openMP
# https://www-user.tu-chemnitz.de/~potts/nfft/download.php
set -e
MTEX_HOME=$(echo "$PWD"/mtex-*.*.*/)
MATLAB_HOME=$(dirname $(dirname $(which matlab)))
@gdlmx
gdlmx / save_bookmarks.py
Created July 18, 2020 02:44
Export Firefox bookmarks
import sqlite3, pandas as pd
conn = sqlite3.connect('places.sqlite')
tinfo= pd.read_sql_query("SELECT * FROM pragma_table_info('moz_places')", conn)
cols = [ 'p.'+c for c in tinfo.name if 'id' not in c ]
tinfo = pd.read_sql_query("SELECT * FROM pragma_table_info('moz_bookmarks')", conn)
cols += [ 'b.'+c for c in tinfo.name if 'id' not in c and 'title' not in c ]
tbmk = pd.read_sql_query("SELECT {0} FROM moz_bookmarks b INNER JOIN moz_places p ON b.fk = p.id".format( ', '.join(cols) ),
conn);
for c in tbmk:
@gdlmx
gdlmx / Qlik JS API.md
Last active August 23, 2022 17:58
Qlik SaaS Web Integration Notes

Summary of Qlik API

Capability API

Reference

Nebula.js

    import { embed } from '@nebula.js/stardust';
@gdlmx
gdlmx / CentOS9-gnome-patch.cil
Last active September 14, 2022 13:17
SELinux debug log in CentOS9
(allow staff_t lib_t (file (watch)))
(allow staff_t non_security_file_type (dir (watch)))
(allow staff_gkeyringd_t pidfile (file (getattr open read)))
@gdlmx
gdlmx / Check_spark_env.py
Last active February 12, 2023 13:54
Scripts for spark on Windows
" check env variables "
# pylint: disable=invalid-name,line-too-long
import os
import pathlib
import subprocess
import logging
logging.basicConfig(level=logging.INFO, format='%(message)s' )
paths_should_exist: list[str]=[
'{DOTNET_ROOT}/dotnet.exe',
@gdlmx
gdlmx / calc_crc32.py
Created March 20, 2023 16:36
Create memory view of file larger than RAM
import mmap
import zlib
import sys
from contextlib import contextmanager
@contextmanager
def f2bytes(fname):
with open(fname, 'rb') as f :
with mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ) as m:
mmview = memoryview(m)