This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required (VERSION 3.1) #yes, CMake 3.1 is required | |
project(myproj C) | |
# https://gist.github.com/scienceopen/9f88bbe4841ea67aa692f7395bb38bfe | |
add_executable(myprog ../myprog.c) | |
find_package(HDF5 REQUIRED) | |
include_directories(${HDF5_INCLUDE_DIR}) | |
target_link_libraries(myprog ${HDF5_C_LIBRARIES}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function expanded = expanduser(p) | |
%% | |
% Examples: | |
% | |
% isunix==1 (linux & cygwin) example: | |
% expanduser('~/Downloads/foo') | |
% ans = /home/joespc/Downloads/foo | |
% | |
% ispc==1 example (Windows) | |
% expanduser('~/Downloads/foo') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ wpa_cli -i wlan0 status | |
ssid=BU (802.1x) | |
id=2 | |
mode=station | |
pairwise_cipher=CCMP | |
group_cipher=TKIP | |
key_mgmt=WPA2/IEEE 802.1X/EAP | |
wpa_state=COMPLETED | |
ip_address=155.41.65.23 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
network={ | |
ssid="BU (802.1x)" | |
key_mgmt=WPA-EAP | |
pairwise=CCMP TKIP | |
eap=TTLS PEAP MSCHAPV2 | |
identity="Your BU login" | |
password="your Kerberos Password: be aware others can read this file!" | |
phase2="auth=MSCHAPV2" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# reference: http://www.raspberrypi.org/phpBB3/viewtopic.php?t=23440 | |
let upSeconds="$(/usr/bin/cut -d. -f1 /proc/uptime)" | |
let secs=$((${upSeconds}%60)) | |
let mins=$((${upSeconds}/60%60)) | |
let hours=$((${upSeconds}/3600%24)) | |
let days=$((${upSeconds}/86400)) | |
UPTIME=`printf "%d days, %02dh%02dm" "$days" "$hours" "$mins" ` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ephem | |
import datetime | |
now = datetime.datetime.now() #get current time | |
Boston=ephem.Observer() | |
Boston.pressure = 1010 # millibar | |
Boston.temp = 25 # deg. Celcius | |
Boston.horizon = 0 | |
Boston.lat='42.3462' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
v = VideoWriter('test.mj2','Motion JPEG 2000'); | |
v.LosslessCompression = true; v.FrameRate=5; | |
open(v) | |
f=figure; title('line'), ylabel('amplitude'),xlabel('index') | |
pause(0.2) %let plot wake up | |
for i=1:.05:3; | |
line(0:.01:1,(0:.01:1).^i) | |
im = getframe(f); | |
writeVideo(v,im) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
do: | |
N = 256; | |
MinVal = 0; | |
MaxVal = 2^16 -1; | |
data = nan(N); | |
temp = uint16(MinVal:round((MaxVal-MinVal)/(N/2)):MaxVal); | |
for i = 1:N/2 | |
data(i,i:end-i+1) = temp(i); | |
data(i:end-i+1,i) = temp(i); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% create data, 25 frames of 512x512 pixels | |
data = rand(512,512,25); | |
%% create blank image | |
img = imagesc(rand(512)); | |
ht = title(''); % to show frame number | |
%% for loop to play "movie" | |
for i = 1:25 | |
set(img,'cdata',data(:,:,i)) % update latest frame |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# finds N biggest directories. | |
# Alternative is "ncdu" a graphical biggest file program | |
\du -hd1 $1 | sort -h | head -n 8 |