This file contains 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
#include <cstdio> // printf | |
#include <algorithm> // make_heap, pop_heap, greater | |
#include <vector> // vector | |
#include <random> // mt19937_64, uniform_real_distribution | |
// Initialize each element of a vector using Mersenne Twister | |
std::vector<int> randomize(const int n) { | |
std::mt19937_64 mt{1}; | |
std::uniform_int_distribution<int> dist{0, 100}; |
This file contains 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
program main | |
use glew_wrapper | |
use glfw3_wrapper | |
implicit none | |
type(c_ptr) :: window | |
integer(GLuint) :: programID, vertexPositionModelSpaceID = 114514 | |
character(kind=c_char, len=*), parameter :: vertexPositionModelSpaceName = "vertexPosition_modelspace"//c_null_char | |
real(GLfloat), target :: g_vertex_buffer_data(9) | |
real(GLfloat), pointer :: g_vertex_buffer_data_ptr => null() |
This file contains 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 main | |
[x, y] = meshgrid(-3:.5:3); | |
[R, J] = romeo_juliet(x, y); | |
%graph | |
quiver(x, y, R, J); | |
xlabel('R'); | |
ylabel('J'); |
This file contains 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
cxxflags = -Wextra -g -O2 -std=c++11 | |
cxx = clang++ | |
rule compile | |
command = $cxx $cppflags -c $in -o $out | |
rule link | |
command = $cxx $in -o $out | |
build main.o : compile main.cpp |
This file contains 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 | |
export LD_LIBRARY_PATH=/usr/local/include/SFML/lib | |
clang++ -o main -std=c++11 -O3 -lsfml-system \ | |
-lsfml-graphics -lsfml-window -lsfml-audio "./main.cpp" && ./main |
This file contains 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
#include "lcd.h" | |
void lcdInit(){ | |
LCD_RW=0; | |
Delay1KTCYx(180); // wait more than 14.94m sec | |
LCD_RS=0; | |
// set 8-bit mode | |
lcdPut8bits(0x03); | |
Delay10KTCYx(5); // wait more than 4.15m sec | |
lcdPut8bits(0x03); |
This file contains 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
#pragma warning(disable : 4996) // If we use VS, we should write this in order to avoid error C4996. | |
#include <iostream> | |
#include <valarray> | |
#include <numeric> | |
// Merritt coil class | |
class MerrittCoil | |
{ | |
public: |
This file contains 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
#include <iostream> | |
int main(){ | |
std::cout << "test" << std::endl; | |
return 0; | |
} |