Skip to content

Instantly share code, notes, and snippets.

View sage-git's full-sized avatar

sage-git

View GitHub Profile
@sage-git
sage-git / build.sh
Created August 13, 2022 16:43
NWChem build on WSL
#!/bin/bash
# preparation
# apt update
# apt upgrade
# apt install make python2.7 libopenblas-dev libelpa-dev libscalapack-openmpi-dev
# git clone https://github.com/nwchemgit/nwchem.git
# mv nwchem
# git checkout v7.0.2-relase
# put this file in "nwchem" directory and run
@sage-git
sage-git / hex_HP.py
Created May 31, 2018 15:36
Rock Paper Scissors Automaton
#!/usr/bin/python
import math
import random
import numpy as np
from scipy import signal
import cv2
root3 = math.sqrt(3.0)
MAX_HP = 8
@sage-git
sage-git / brownian_tree.py
Created May 23, 2018 16:03
Maze of Brownian tree
#!/usr/bin/python
from __future__ import division
from __future__ import print_function
import sys
import random
import numpy as np
import cv2
@sage-git
sage-git / gomoku.py
Created May 21, 2018 15:52
count bits with correlation2d
#!/usr/bin/python
# find 5 in line using correlation2d
from __future__ import print_function
import sys
import numpy as np
from scipy import signal
def main():
@sage-git
sage-git / lifegame.py
Last active May 20, 2018 05:34
Lifegame in python
#!/usr/bin/python
from __future__ import print_function
import os
import sys
import numpy as np
from scipy import signal
import cv2
mask = np.ones((3, 3), dtype=int)
@sage-git
sage-git / lifegame.f90
Last active May 19, 2018 06:31
Lifegame in fortran
module lifegame
implicit none
integer :: W, H
integer, allocatable :: field(:, :)
integer, allocatable :: neighbors(:, :)
contains
subroutine init_field(width, height, start_ratio)
integer, intent(in) :: width, height
double precision, intent(in) :: start_ratio
double precision, allocatable :: s(:, :)
@sage-git
sage-git / fork_in_test.bats
Last active May 17, 2018 01:36
fork process in a BATS test script
# Aimed to test running script status.
# In this script, check the sleep process which is forked during a test script.
@test "count_process_extshell" {
echo "#!/bin/bash" > fork_shell.sh
echo "" >> fork_shell.sh
echo "sleep 1 &" >> fork_shell.sh
echo "ps ax | grep -E \"[0-9] sleep\" | wc -l" >> fork_shell.sh
ret=$(bash fork_shell.sh)