Skip to content

Instantly share code, notes, and snippets.

@ikarino
ikarino / Dockerfile
Last active August 28, 2018 00:52
OpenMC dockerfile
FROM centos:latest
MAINTAINER ikarino <ba138ng@gmail.com>
# Run docker command with
# $ docker run -it --name=XXXX -p 8888:8888 image-name
# and open browser with given url and token
ENV FC=/usr/lib64/openmpi/bin/mpif90 CC=/usr/lib64/openmpi/bin/mpicc HDF5_ROOT=/usr/lib64/openmpi \
PATH=/opt/openmc/bin:/opt/conda/bin:$PATH \
OPENMC_CROSS_SECTIONS=/opt/openmc/data/nndc_hdf5/cross_sections.xml
@ikarino
ikarino / system.gp
Last active August 29, 2015 14:14
System commands from gnuplot macro
#!/usr/local/bin/gnuplot
set term pngcairo
set output "sinx.png"
set xlabel "X" font "Helvetica, 30"
plot \
sin(x) lt 1 t'line type 1'
on selectSettingTab(index)
tell application "System Events"
tell process "OBS"
tell window "Settings"
activate
set p to position
set x to (item 1 of p) + 100
set y to (item 2 of p) + 20 + index * 50
set cmd to "cliclick c:" & x as string & "," & y as string
-- display dialog cmd
@ikarino
ikarino / gist:3f622287a1e23fe84150
Last active August 29, 2015 14:13
login nico applescript
on loginFromSafari(username, password)
set loginURL to "https://secure.nicovideo.jp/secure/login_form"
tell application "Safari"
activate
make new document with properties {URL:loginURL}
delay 1
do JavaScript "document.getElementsByName('mail_tel')[0].value = '" & username & "';" in document 1
do JavaScript "document.getElementsByName('password')[0].value = '" & password & "';" in document 1
do JavaScript "document.getElementsByClassName('login_button')[0].children[0].click();" in document 1
close document 1
@ikarino
ikarino / command.tpl
Created December 19, 2014 12:15
bottle_subprocess
<body>
<h3>cmd</h3>
<form method="get" action="/cmd">
<input type="text" name="cmd">
<input type="submit" value="exec">
</form>
<h3>stdout</h3>
<tt>
%for out in stdout:
{{out}}<br />
@ikarino
ikarino / proc.py
Last active August 29, 2015 14:11
bottle_subprocess
#!/usr/bin/env python
import subprocess
@route('/command', method='GET')
def out():
stdout = ""
stderr = ""
command = None
command = request.GET.get("command")
if command:
@ikarino
ikarino / checkgxx.py
Created December 3, 2014 15:42
check version of g++ in Sakura
#!/usr/local/bin/python
import subprocess
print 'Content-type: text/html; charset=utf-8'
print "\r\n\r\n"
print "Checking status<br />"
proc = subprocess.Popen("/usr/bin/g++ -v", shell=True,
@ikarino
ikarino / fit.py
Last active August 29, 2015 14:10
fit
#!/usr/bin/env python2.7
import numpy
import scipy
import scipy.optimize
import subprocess
def plotme(gnuplottext, filename=None):
if filename:
bash-3.2$ ls -1
ADC1-000.dat
ADC1-001.dat
ADC1-002.dat
ADC1-003.dat
ADC1-004.dat
ADC1-005.dat
ADC1-006.dat
ADC1-007.dat
ADC1-008.dat
@ikarino
ikarino / plotADC1.gp
Last active August 29, 2015 14:10
successive file into gif animation by gnuplot
#!/usr/bin/env gnuplot
set term gif animate optimize
set output 'ADC1.gif'
do for[i=0:8:1] {
file = sprintf("ADC1-%03d.dat", i)
time = sprintf("t=%d-%d[sec]", i*200, (i+1)*200)
set title time
plot file w l
}