Skip to content

Instantly share code, notes, and snippets.

View auxiliary's full-sized avatar

Mohammad (Moa) Raji auxiliary

View GitHub Profile
@auxiliary
auxiliary / vl.sh
Last active August 29, 2015 14:15
VL (Vim Layouts)
#!/bin/bash
#Show help and exit
if [ $# -eq 0 ] || [ $1 == "-h" ] || [ $1 == "--help" ];
then
echo "Usage: vl [OPTION] [FILE]..."
echo "Open vim for FILEs with automatic layouts."
echo "OPTION:"
echo -e " -t, --tabbed \t open 2 FILEs per tab, splitting each tab vertically"
echo -e " -H, --htabbed \t open 2 FILEs per tab, splitting each tab horizontally"
@auxiliary
auxiliary / .vimrc
Last active May 30, 2016 05:48
vimrc
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
@auxiliary
auxiliary / custombox_addon.js
Last active August 29, 2015 14:22
A data-attribute add-on for custombox
function open_custombox()
{
var modal_settings = $(this).data("modal");
if (typeof(modal_settings) === 'string')
{
Custombox.open({
target: modal_settings
});
}
else if(typeof(modal_settings) === 'object')
'''=========================================================================
Program: Visualization Toolkit
Module: vtk1DGaussianTransferFunction.cxx (Python version)
Converted to Python by Mohammad A.Raji ([email protected])
Copyright (c) Ken Martin, Schroeder, Lorensen
All rights reserved.
See Copyright.txt or http:#www.kitware.com/Copyright.htm for details.
def seto(x, width, height):
c = GaussianControlPointList()
p = GaussianControlPoint()
p.x = x
p.width = width
p.height = height
c.AddControlPoints(p)
v = GetPlotOptions()
v.SetOpacityControlPoints(c)
SetPlotOptions(v)
def seto(x, width, height):
c = GaussianControlPointList()
p = GaussianControlPoint()
p.x = x
p.width = width
p.height = height
c.AddControlPoints(p)
v = GetPlotOptions()
v.SetOpacityControlPoints(c)
SetPlotOptions(v)
#for isabel
import itertools
def set_annotation_attributes():
# Logging for SetAnnotationObjectOptions is not implemented yet.
AnnotationAtts = AnnotationAttributes()
AnnotationAtts.axes2D.visible = 0
AnnotationAtts.axes2D.autoSetTicks = 1
AnnotationAtts.axes2D.autoSetScaling = 1
AnnotationAtts.axes2D.lineWidth = 0
AnnotationAtts.axes2D.tickLocation = AnnotationAtts.axes2D.Outside # Inside, Outside, Both
# In case you need byte arrays
import numpy as np
a = np.uint64(7640891576956014592) #64 bits
b = a.tostring() # '\x00\xd0\xbc\xf3g\xe6\tj' in bytes
b = bytearray(b) # bytearray(b'\x00\xd0\xbc\xf3g\xe6\tj') Byte array object
# Padding
a = [1, 1, 1, 1, 1]
a + [0] * (16 - len(a)) # [1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
#!/usr/bin/python
import numpy as np
import sys
sys.path.append('/home/mohammad/Downloads/visit2_10_0.linux-x86_64/2.10.0/linux-x86_64/lib/site-packages')
import vtk
from vtk.util.vtkConstants import *
#!/usr/bin/env python
import numpy as np
def getDegree(ref_id, grid_list):
results = np.zeros(grid_list[0].shape)
for i, grid in enumerate(grid_list):
results += (grid_list[ref_id] == grid)
return results / float(len(grid_list)) * 100