start new:
tmux
start new with session name:
tmux new -s myname
| import numpy as np | |
| from scipy.integrate import odeint | |
| import math | |
| import matplotlib.pyplot as plt | |
| def xvyplot(t,sol,e): | |
| plt.plot(sol[:, 0],sol[:, 1] , 'p', label='x(t) vs y(t)') | |
| plt.title("x v y with eccentricity of " + str(e)) | |
| plt.legend(loc='best') | |
| plt.xlabel('x') |
| import argh | |
| def do_the_thing(required_arg, optional_arg=1, other_optional_arg=False): | |
| """ | |
| I am a docstring | |
| """ | |
| print((required_arg, type(required_arg))) | |
| print((optional_arg, type(optional_arg))) | |
| print((other_optional_arg, type(other_optional_arg))) |
| import numpy as np | |
| def cutrod(p,n): | |
| if n == 0: | |
| return 0 | |
| q = -1*np.inf | |
| for i in range(n): | |
| i_ = i+1 | |
| q = np.max([q, p[i_-1] + cutrod( p,n - i_) ]) | |
| return q |
| #learned from complex analysis class that the known way of integrating 1/(1+x^2) is by applying the resideue theorem | |
| import scipy.integrate as i | |
| import numpy as np | |
| f = lambda x: 1.0/(1+x**2) | |
| print(str(i.quad(f,0,np.inf)[0])) |
| import numpy as np | |
| from memory_profiler import profile | |
| @profile | |
| def main(): | |
| a = np.ones((1000,1000)) | |
| a = a +1 | |
| print(a) | |
| main() |
| #include <iostream> | |
| #include <fstream> | |
| using namespace std; | |
| template<size_t n, size_t k> struct combo; | |
| template<size_t n> | |
| struct combo<n,0>{ | |
| const static auto value =1; |
| /** @jsx React.DOM */ | |
| var LikeButton = React.createClass({ | |
| getInitialState: function() { | |
| return {liked: false}; | |
| }, | |
| handleClick: function(event) { | |
| this.setState({liked: !this.state.liked}); | |
| }, | |
| render: function() { |
| $(document).ready(function(){ | |
| TableBuilder = function(username, tabledata){ | |
| this.username = username; | |
| this.tabledata = tabledata; | |
| } | |
| TableBuilder.prototype.populateTable = function() { | |
| var self = this; | |
| var tableId = 'my-table'; | |
| this.dynatable = $('#'+tableId).dynatable({ |
| function moveThroughYelp(data, type){ | |
| var setOfInfo = [] | |
| for(var i = 0; i< data.businesses.length; ++i){ | |
| var info = {} | |
| if (!data.businesses[i].is_closed || (type === 'food' && data.businesses[i].rating<2 ) ) continue; | |
| info.rating = data.businesses[i].rating; | |
| info.rating_img_url_small= data.businesses[i].rating_img_url_small; | |
| info.rating_img_url_large = data.businesses[i].rating_img_url_large; | |
| info.rating_img_url = data.businesses[i].rating_img_url; | |
| info.address = data.businesses[i].location.address + ' ' + data.businesses[i].location.city + ', ' + data.businesses[i].location.state_code + ' ' +data.businesses[i].location.postal_code |