Skip to content

Instantly share code, notes, and snippets.

View putanowr's full-sized avatar

Roman Putanowicz putanowr

View GitHub Profile
@putanowr
putanowr / simplecli.py
Created October 15, 2019 10:54
Simple program illustraing command line parsing with argparse module
# -*- coding: utf-8 -*-
""""
This script illustrates command line handling
"""
import argparse
def make_parser():
"""Build command line parser"""
@putanowr
putanowr / readcoords.asy
Last active July 1, 2019 12:42
Reading data from file in Asymptote
file fin=input('readcoords.dat');
pair [] xy;
real cx,cy;
int n = fin;
for (int i=0; i<n; ++i) {
cx= fin;
cy = fin;
xy.push((cx,cy));
}
write(xy);
@putanowr
putanowr / simplebeam.m
Created March 15, 2019 00:06
Octave: Simple application with GUI
% This is quick-and-dirty attempt at buildig simple
% application in Octave using GUI control.
% The application allows to crate and visualise simple 1D mesh.
close all
clear app
graphics_toolkit qt
function app = generate_mesh(app)
@putanowr
putanowr / make_struct.m
Last active November 22, 2018 19:12
Matlab: Creating structure from keys and values
names = {'ala', 'ola', 'ula'};
codes = [3,2,1];
selector = struct();
for i=1:length(names)
selector.(names{i}) = codes(i);
end
disp(selector);
@putanowr
putanowr / deform2disk.m
Created November 6, 2018 21:38
Deformation of unit square into a qarter of a disk
%% Deformation of unit square into quarter of a disk
% This script illustrates how to generate displacement field that
% deforms unit square into quarter of a disk. Subsequent visualization
% is done in a way that closely resembles visualizatio done in ParaView
% (with default settings).
clf
clear all
N = 10;
x = linspace(0,1,N);
@putanowr
putanowr / strings.geo
Created October 24, 2018 09:58
List of strings in GMSH
// To run: gmsh - strings.geo -v 3
names[] = Str("ola", "ola", "ula");
msg = StrCat("Message for ", names[2]);
Printf(msg);
@putanowr
putanowr / LICENSE
Last active September 25, 2018 07:25
This license applies to all public gists https://gist.github.com/putanowr
MIT License
Copyright (c) 2018 Roman Putanowicz
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: