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 newton(n, r, p = 0): | |
""" | |
(int(n), num(r), int(p)) -> float | |
Return the nth root of a positive number r displaying p correct decimals. | |
""" | |
x = 1 # start with guess = 1 | |
while True: | |
fx = x**n - r # function of this form solves all roots |
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
# Naive implementation of reduce normal form with some helper functions | |
from fractions import * | |
# helper functions | |
def row_sub(reduceby, reduceto, index): | |
""" | |
Take row to reduce and row to reduce by with the index of the element to | |
reduce to 0. Assume reduce by has value 1 in the index of reduceto. | |
""" | |
row_merged = [] |
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
module ring(inner_radius, thickness, height) | |
{ | |
outer_radius = inner_radius + thickness; | |
padding = 0.1; | |
difference() | |
{ | |
cylinder(r=outer_radius,h=height,center=true); | |
cylinder(r=inner_radius,h=height+padding,center=true); |
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
var timer = setInterval(transform,50); | |
var degreez = 0; | |
var allSet = false; | |
var bellybutton; | |
function transform(){ | |
if (!allSet) { | |
var transOrigin = "50% 50%"; | |
document.body.parentElement.style.height = "100%"; | |
document.body.style.minHeight = "100%"; | |
document.body.style.transformOrigin = transOrigin; |
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 <map> | |
#include <algorithm> // fill_n, trivially replaceable | |
// sorts in place based on frequency | |
template <typename Iter> | |
void freq_sort(Iter begin, Iter end) { | |
using T = typename Iter::value_type; | |
if (begin == end) return; | |
T current {*begin}; |
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> | |
template <typename TwoD> | |
void print2D(const TwoD& mat, size_t m, size_t n) { | |
for (size_t row = 0; row < m; ++row) { | |
for (size_t col = 0; col < n; ++col) | |
std::cout << mat[row][col] << ' '; | |
std::cout << std::endl; | |
} | |
} |
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
@g++ -IC:\Users\Johnson\Documents\mylibs -o %1 %1.cpp %2 %3 %4 %5 %6 %7 %8 %9 -std=c++11 2> log.txt && echo no error |
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
" Remember to install Vundle with git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim | |
" set nocompatible " be iMproved, required | |
" filetype off " required | |
" set the runtime path to include Vundle and initialize | |
" set rtp+=~/.vim/bundle/Vundle.vim | |
" call vundle#begin() | |
" let Vundle manage Vundle, required | |
" Plugin 'gmarik/Vundle.vim' |
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
- Autoformatting with clang-format and CppStyle addon for eclipse | |
- an IDE (seriously, vim and sublime is nice and all, but for any large production project IDEs will save a lot of effort and time) |
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
gnome-terminal --load-config=~/cfg | |
gnome-terminal --save-config=~/cfg |
OlderNewer