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
#!/usr/bin/python | |
import math | |
import numpy as np | |
from numpy import linalg as LA | |
# Function to approximate | |
def f(x): |
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 <array> | |
#include <assert.h> | |
#include <bitset> | |
#include <iostream> | |
#include <limits.h> | |
#include <ostream> | |
template <size_t N> class bitfield : public std::bitset<N> { | |
public: | |
bitfield(std::array<unsigned char, N / CHAR_BIT> bytes) |
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 <assert.h> | |
#include <bitset> | |
#include <iostream> | |
#include <limits> | |
#include <random> | |
#define ALU_ADD 0 | |
#define ALU_SUB 1 | |
#define ALU_AND 2 | |
#define ALU_OR 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
def convert(x, N): | |
y = x % N | |
x = x // N | |
if (x == 0): | |
return [y] | |
else: | |
return convert(x, N) + [y] | |
print(convert(10001, 16)) |
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
// | |
// threadpool.c | |
// threadpool | |
// | |
#include "threadpool.h" | |
static void *sweep(void *voidtask) | |
{ | |
task *task = voidtask; |
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 sys | |
# Constants | |
OPERATORS = ['*', '/', '+', '-'] | |
DECIMAL_SYMBOLS = [',', '.'] | |
SIGN_SYMBOLS = ['-', '+'] | |
PARENTHESIS_OPEN = '(' | |
PARENTHESIS_CLOSE = ')' | |
PRECEDENCE = [[PARENTHESIS_OPEN], ['*', '/'], ['+', '-']] |
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> | |
#include <ctime> | |
#include <tuple> | |
constexpr const std::tuple<unsigned long, unsigned long> max(const unsigned int a, const unsigned int b) | |
{ | |
const auto c = [](auto&& s, const unsigned long n) constexpr -> const unsigned int { | |
if (n == 1) return 1; | |
return 1 + s(s, n % 2 ? n * 3 + 1 : n / 2); | |
}; |
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 | |
if [ "$1" != "" ]; then | |
git submodule deinit -f -- $1 | |
rm -rf .git/modules/$1 | |
git rm -f $1 | |
fi |
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
float k1 = 0.0; | |
float k2 = 0.0; | |
float k3 = 0.0; | |
float p1 = 0.0; | |
float p2 = 0.0; | |
const int lk = 12; | |
void mainImage( out vec4 fragColor, in vec2 fragCoord ) |
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
#!/usr/bin/python | |
import sys | |
import numpy | |
import Queue | |
import numpy as np | |
import random | |
import matplotlib.pyplot as plt | |
NewerOlder