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
import random | |
import os | |
char_left = -1 | |
def render(self, choosen): | |
os.system('cls' if os.name == 'nt' else 'clear') | |
## All credit for these little pictures is to reddit user Magical Pop. Kudos to him! (He made a good version of this too!) |
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
import math,decimal, os, time, cProfile, multiprocessing | |
from decimal import Decimal as large | |
## Simple Libnitz forumla pi calculation SigFig=15 | |
def additivecalc(nlim): | |
pi = float(0) | |
while n < xrange(nlim): | |
pi += float(((-1)**n)*4) / float(2*n + 1) | |
return pi |
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
# Call this with arguments of size, and the name of the png file of the result | |
# eg. python Rule90OpenCLSerpinki.py 1000 rule90serpinki.png | |
# Needs PyOpenCL, Numpy, and MatPlotLib | |
from time import time | |
timer = time() | |
import pyopencl as cl | |
from pyopencl import array | |
import numpy as np | |
from sys import argv |
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
import numpy as np | |
import time | |
from collections import Counter | |
from numba import jit | |
def to_int(ip_str): | |
ip = map(int, ip_str.strip().split(".")) | |
return (ip[0] << 24) + (ip[1] << 16) + (ip[2] << 8) + (ip[3]) |
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
$ cmake -DCC=/mingw64/bin/gcc.exe -DCXX=/mingw64/bin/g++.exe ../llvm -G "MSYS Makefiles" -DLLVM_TARGETS_TO_BUILD=X86 -DCMAKE_BUILD_TYPE=Release | |
-- The C compiler identification is GNU 6.1.0 | |
-- The CXX compiler identification is GNU 6.1.0 | |
-- The ASM compiler identification is GNU | |
-- Found assembler: C:/msys64/mingw64/bin/gcc.exe | |
-- Check for working C compiler: C:/msys64/mingw64/bin/gcc.exe | |
-- Check for working C compiler: C:/msys64/mingw64/bin/gcc.exe -- works | |
-- Detecting C compiler ABI info | |
-- Detecting C compiler ABI info - done | |
-- Detecting C compile features |
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
Determining if the include file dlfcn.h exists failed with the following output: | |
Change Dir: C:/llvm/build/CMakeFiles/CMakeTmp | |
Run Build Command:"C:/msys64/mingw64/bin/make.exe" "cmTC_da95a/fast" | |
C:/msys64/mingw64/bin/make.exe -f CMakeFiles/cmTC_da95a.dir/build.make CMakeFiles/cmTC_da95a.dir/build | |
make.exe[1]: Entering directory 'C:/llvm/build/CMakeFiles/CMakeTmp' | |
Building C object CMakeFiles/cmTC_da95a.dir/CheckIncludeFile.c.obj |
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
./dataBlueprint.cpp: In constructor 'shaderUtils::dataBlueprint::dataBlueprint(std::vector<std::__cxx11::basic_string<char> >)': | |
./dataBlueprint.cpp:25:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] | |
for (int i = 0; i < format.size(); ++i) { | |
~~^~~~~~~~~~~~~~~ | |
./Drawable.cpp: In constructor 'Drawable::Drawable()': | |
./Drawable.cpp:10:26: warning: pure virtual 'virtual int& Drawable::getInstanceCount()' called from constructor | |
if (getInstanceCount() == 0) { | |
^ | |
./Drawable.cpp:12:26: warning: pure virtual 'virtual int& Drawable::getInstanceCount()' called from constructor | |
getInstanceCount() += 1; |
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 <tmmintrin.h> | |
#include <immintrin.h> | |
#include <smmintrin.h> | |
void Fpt3::FastNormalize() { | |
__m128 inputs = _mm_setr_ps(x, y, z, 0); | |
__m128 squared = _mm_mul_ps(inputs, inputs); | |
__m128 sum; | |
#ifdef __SSE3__ | |
sum = _mm_hadd_ps(squared, squared); |
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
class Fpt3Container { | |
private: | |
std::vector<float> x; | |
std::vector<float> y; | |
std::vector<float> z; | |
public: | |
Fpt3Container(std::vector<Fpt3>& val) { | |
x.reserve(val.size()); | |
y.reserve(val.size()); |
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 <cinttypes> | |
#include <cmath> | |
#include <limits> | |
// Various magic numbers for functions | |
namespace magic_numbers { | |
// Coefficients for polynomial to approximate log(x) | |
constexpr static float logc0 = -2.4204054330123117482f; | |
constexpr static float logc1 = 5.8848619015611924602f; | |
constexpr static float logc2 = -7.4051206397067798695f; |
OlderNewer