Skip to content

Instantly share code, notes, and snippets.

View edwinksl's full-sized avatar

Edwin Khoo edwinksl

View GitHub Profile
@edwinksl
edwinksl / quasi-neutral-1D-electrolyte.py
Created January 17, 2016 04:29
FiPy quasi-neutral 1D electrolyte
import fipy as fp
solver = fp.LinearGMRESSolver()
Lx = 1.
nx = 1000
dx = Lx/nx
mesh = fp.Grid1D(nx=nx, dx=dx)
phi = fp.CellVariable(name="elec. potential", mesh=mesh, value=0.)
c_m = fp.CellVariable(name="conc.", mesh=mesh, value=1.0)
% Code for http://stackoverflow.com/a/37982813/486919
function schrodinger_equation
close all
clc
psi0 = [0;1];
hbar = 1;
% t = 0:1:100;
@edwinksl
edwinksl / .bashrc
Last active September 10, 2016 05:28
Default .bashrc for Ubuntu 16.04 copied from /etc/skel/.bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
@edwinksl
edwinksl / .profile
Created June 30, 2016 17:44
Default .profile for Ubuntu 16.04 copied from /etc/skel/.profile
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
@edwinksl
edwinksl / password_generator.py
Last active July 1, 2016 18:08
Password generator
#!/usr/bin/env python3
import math
import random
from string import digits, ascii_letters, punctuation
import sys
char_set = digits + ascii_letters + punctuation + ' '
@edwinksl
edwinksl / install.sh
Created July 12, 2016 17:08
Installation script for DAE Tools
#!/bin/bash
cd ~/svn
svn checkout svn://svn.code.sf.net/p/daetools/code/trunk daetools-code
cd daetools-code
chmod +x install_dependencies_linux.sh compile_libraries_linux.sh compile_linux.sh
./install_dependencies_linux.sh
./compile_libraries_linux.sh --with-python-version 3.5 boost ref_blas_lapack umfpack idas superlu superlu_mt bonmin nlopt # compile everything except Trilinos and deal.II
./compile_linux.sh --with-python-version 3.5 dae superlu superlu_mt ipopt bonmin nlopt # compile everything except Trilinos and deal.II
@edwinksl
edwinksl / problem_10.py
Created July 14, 2016 04:47
Brute-force search for prime numbers
#!/usr/bin/env python
import sys
import time
def main(number):
prime_numbers = [2]
for i in range(3, number, 2):
if is_prime(i, prime_numbers):
@edwinksl
edwinksl / opengl_ubuntu_16.10.txt
Created October 16, 2016 13:41
OpenGL version information in Ubuntu 16.10
$ glxinfo | grep version
server glx version string: 1.4
client glx version string: 1.4
GLX version: 1.4
Max core profile version: 3.3
Max compat profile version: 3.0
Max GLES1 profile version: 1.1
Max GLES[23] profile version: 3.0
OpenGL core profile version string: 3.3 (Core Profile) Mesa 12.0.3
OpenGL core profile shading language version string: 3.30
@edwinksl
edwinksl / software_opengl_matlab_r2016b_ubuntu_16.10.txt
Created October 16, 2016 17:17
Software OpenGL information for MATLAB R2016b in Ubuntu 16.10
$ matlab -nodesktop -nosplash -softwareopengl
MATLAB is selecting SOFTWARE OPENGL rendering.
< M A T L A B (R) >
Copyright 1984-2016 The MathWorks, Inc.
R2016b (9.1.0.441655) 64-bit (glnxa64)
September 7, 2016
To get started, type one of these: helpwin, helpdesk, or demo.
@edwinksl
edwinksl / debug.md
Last active June 5, 2017 03:21
Debugging information