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
| struct Vec { | |
| float x,y,z; | |
| }; | |
| static inline bool hasPrefix(const std::string &str, const std::string &prefix) { | |
| return (str.size() >= prefix.size()) | |
| && (std::mismatch(prefix.cbegin(), prefix.cend(), str.cbegin()).first == prefix.cend()); | |
| }; | |
| static inline std::vector<std::string> split(const std::string &str, const char delim) { |
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
| g = @(r) 2 .* r - sin(2 .* r); | |
| gd = @(r) 2 .* r - sin(2 .* r); | |
| gdd = @(r) 2 .* r - sin(2 .* r); | |
| u = @(r) sin(r) / (r * 1 + (g(r) .^ 2)); | |
| r = 1:.1:100; |
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
| #pragma once | |
| #include <immintrin.h> | |
| class Vec { | |
| private: | |
| /// Members | |
| __m256d xyzw; | |
| public: |
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
| #include <type_traits> | |
| class A {}; | |
| class B {}; | |
| class C : public A {}; | |
| class D : public B {}; | |
| template<typename T> |
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
| glutInit(&argc, &argv); | |
| glutInitWindowSize(WIDTH, HEIGHT); | |
| // Centre Window | |
| int sw = glutGet(GLUT_SCREEN_WIDTH); | |
| int sh = glutGet(GLUT_SCREEN_HEIGHT); | |
| glutInitWindowPosition((sw / 2) - (WIDTH / 2), (sh / 2) - (HEIGHT / 2)); | |
| glutCreateWindow("Hello"); |
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
| spi-bcm2708 | |
| fbtft_device name=waveshare32b gpios=dc:22,reset:27 speed=48000000 | |
| waveshare32b width=320 height=240 buswidth=8 init=-1,0xCB,0x39,0x2C,0x00,0x34,0x02,-1,0xCF,0x00,0XC1,0X30,-1,0xE8,0x85,0x00,0x78,-1,0xEA,0x00,0x00,-1,0xED,0x64,0x03,0X12,0X81,-1,0xF7,0x20,-1,0xC0,0x23,-1,0xC1,0x10,-1,0xC5,0x3e,0x28,-1,0xC7,0x86,-1,0x36,0x28,-1,0x3A,0x55,-1,0xB1,0x00,0x18,-1,0xB6,0x08,0x82,0x27,-1,0xF2,0x00,-1,0x26,0x01,-1,0xE0,0x0F,0x31,0x2B,0x0C,0x0E,0x08,0x4E,0xF1,0x37,0x07,0x10,0x03,0x0E,0x09,0x00,-1,0XE1,0x00,0x0E,0x14,0x03,0x11,0x07,0x31,0xC1,0x48,0x08,0x0F,0x0C,0x31,0x36,0x0F,-1,0x11,-2,120,-1,0x29,-1,0x2c,-3 | |
| ads7846_device model=7846 cs=1 gpio_pendown=17 speed=1000000 keep_vref_on=1 swap_xy=0 pressure_max=255 x_plate_ohms=60 x_min=200 x_max=3900 y_min=200 y_max=3900 |
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
| struct Pixel { | |
| Colour val; | |
| real_t cnt; | |
| // Stats on Luminance | |
| real_t mean, var, skew, kurtosis, m2, m3, m4; | |
| inline void add(const Colour &col) { | |
| val = val + ((col - val) / ++cnt); |
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
| void glPrintString(void *font, const char *str) { | |
| int len, i; | |
| len = (int)strlen(str); | |
| for (i = 0; i < len; i++) { | |
| glutBitmapCharacter(font, str[i]); | |
| } | |
| } | |
| void glPrintString(int x, int y, std::string str) { |
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
| #include <cstdio> | |
| #include <omp.h> | |
| #include <cassert> | |
| using namespace std; | |
| constexpr int T_SIZE = 1e8; | |
| // Bitwise operator based function to check multiple of 9 | |
| bool isMulOf9(int n) { |
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
| #include <cstdio> | |
| // C-Quine | |
| int main() { | |
| char *s = "#include <cstdio>%c// C-Quine%cint main() {%c char *s = %c%s%c;%c printf(s, 0x0a, 0x0a, 0x0a, 0x22, s, 0x22, 0x0a, 0x0a, 0x0a);%c return 1;%c};"; | |
| printf(s, 0x0a, 0x0a, 0x0a, 0x22, s, 0x22, 0x0a, 0x0a, 0x0a); | |
| return 1; | |
| }; |