Skip to content

Instantly share code, notes, and snippets.

View yudhastyawan's full-sized avatar
💭
Computational Geophysics

Yudha Styawan yudhastyawan

💭
Computational Geophysics
View GitHub Profile
@yudhastyawan
yudhastyawan / cout.cpp
Created January 27, 2020 05:44
An example of costumizing std::cout in C++
#include <iostream>
#include <ostream>
struct Vector
{
int x, y;
Vector(int X, int Y) : x(X), y(Y) {}
};
std::ostream& operator<<(std::ostream& stream, const Vector& other)
@yudhastyawan
yudhastyawan / timer.cpp
Created January 27, 2020 05:32
Check your C++ code performance (speed time)
#include <iostream>
#include <chrono>
class Timer
{
public:
Timer()
{
m_StartTimePoint = std::chrono::high_resolution_clock::now();
}
@yudhastyawan
yudhastyawan / gmtgrid1.sh
Created January 9, 2020 07:32
Convert a *.grid file to ASCII using GMT 5 (Tracking Mode)
#!/bin/bash
inputgrd='data.grd'
start=100/-2
end=93/5
gmt project -C$start -E$end -G1 -Q | gmt grdtrack -G$inputgrd > data.xyz
awk '{print $1, $2, $4}' data.xyz > datarev.xyz