- C-faq http://c-faq.com/index.html
- floating point - https://randomascii.wordpress.com/2012/03/08/float-precisionfrom-zero-to-100-digits-2/
- bit fields - https://www.tutorialspoint.com/cprogramming/c_bit_fields.htm
- overflow detection xor - http://www.c-jump.com/CIS77/CPU/Overflow/lecture.html
- kociemba, rubik's cube stuff - http://kociemba.org/cube.htm
- korf paper - https://www.cs.princeton.edu/courses/archive/fall06/cos402/papers/korfrubik.pdf
- regex paper - https://www.cs.princeton.edu/courses/archive/spr09/cos333/beautiful.html
- ray tracing - https://github.com/RayTracing/raytracing.github.io
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
| #define PRINT_BYTE(x) (print_bits((x), 8)) | |
| #define PRINT_WORD(x) (print_bits((x), 16)) | |
| #define PRINT_DWORD(x) (print_bits((x), 32)) | |
| #define PRINT_QWORD(x) (print_bits((x), 64)) | |
| void print_bits(unsigned long long int n, int s) | |
| { | |
| if (s == 0) | |
| return; | |
| print_bits(n >> 1, s - 1); |
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
| unsigned char rotate_left(unsigned char b) | |
| { | |
| unsigned char first = b & 0x80; | |
| b <<= 1; | |
| b |= first >> 7; | |
| return b; | |
| } | |
| unsigned char rotate_right(unsigned char b) | |
| { |
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
| ; Only need to save reg if we use them after | |
| ; caller rules: | |
| ; 1. save caller-saved reg r10, r11 | |
| ; /!\ all param reg | |
| ; 2. pass param with regs rdi, rsi, rdx, rcx, r8, r9 | |
| ; if there is more pass them onto the stack in reverse order | |
| ; 3. use call | |
| ; 4. restore stack state by removing passed on the stack param | |
| ; 5. return value of callee in rax |
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
| with Ada.Numerics.Discrete_random; | |
| with Ada.Text_io; use Ada.Text_io; | |
| with Ada.Integer_Text_io; use Ada.Integer_Text_io; | |
| procedure Craps is | |
| subtype Interval is Integer range 1..6; | |
| package IntRandom is new Ada.Numerics.Discrete_random(Interval); | |
| use IntRandom; | |
| gen: Generator; |
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
| hi |
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 <cassert> | |
| #include <iostream> | |
| #include <string> | |
| #include <GL/glew.h> | |
| #include <GLFW/glfw3.h> | |
| static | |
| unsigned int compileShader(unsigned int type, const std::string& source) | |
| { | |
| unsigned int id = glCreateShader(type); |
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
| __kernel void function(__global char *data) | |
| { | |
| data[0] = 'H'; | |
| data[1] = 'e'; | |
| data[2] = 'l'; | |
| data[3] = 'l'; | |
| data[4] = 'o'; | |
| data[5] = '\n'; | |
| data[6] = '\0'; | |
| } |
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 os | |
| import requests | |
| from bs4 import BeautifulSoup | |
| url_base = "http://tldp.org/HOWTO/NCURSES-Programming-HOWTO" | |
| dir_name = "ncurses_howto" | |
| respond = requests.get("http://tldp.org/HOWTO/NCURSES-Programming-HOWTO") | |
| if respond.status_code != 200: | |
| raise IOError |