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
| lazy var myWindowController: MyWindowController = { | |
| let storyboard = NSStoryboard.init(name: "MyStoryboard", bundle: nil) | |
| let myWindowController = storyboard.instantiateController(withIdentifier: "MyWindowControllerID") as! NSWindowController | |
| return myWindowController as! MyWindowController | |
| }() |
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
| def string(i, b): | |
| """represent any integer i as a base b string where 2<=b<=10""" | |
| import math | |
| start = b**int(math.log(i,b)) | |
| def _string(i,b,val): | |
| digit = int(i/val) | |
| return str(digit) + (_string(i-digit*val, b, val/b) if i-digit != 0 else "") | |
| return _string(i,b,start) |
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 matplotlib as mpl | |
| import matplotlib.pyplot as plt | |
| from cycler import cycler | |
| import numpy as np | |
| nice_fonts = { | |
| # Use LaTeX to write all text | |
| "text.usetex": True, | |
| "font.family": "serif", | |
| "axes.labelsize": 11, |
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
| gigs = 30 | |
| old_command = gap._Expect__command | |
| s = old_command.index('-o ') | |
| e = old_command.index(' -', s) | |
| gap._Expect__command = gap._Expect__command.replace(gap._Expect__command[s:e], f'-o {gigs}G') |
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
| dictionary = { 'a': [1,3,8], 'b': [1,2,4,7], 'c': [5,6,8] } | |
| flat_dictionary = [ (k,v) for k in dictionary.keys() for v in dictionary[k]] | |
| x,y = zip(*flat_dictionary) |
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
| def function_factory(things): | |
| funcs = [] | |
| for thing in things: | |
| def do_something(x, _thing=thing): | |
| return do_some_stuff(x, _thing) | |
| funcs.append(do_something) | |
| return funcs |
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
| cp -R new diff | |
| latexdiff -t BOLD old/main.tex new/main.tex > diff/main.tex | |
| cd diff | |
| latex -interaction nonstopmode main | |
| bibtex main | |
| latex -interaction nonstopmode main | |
| pdflatex main |
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
| from cProfile import Profile | |
| from pstats import SortKey, Stats | |
| with Profile() as profile: | |
| # Code goes here | |
| my_function() | |
| # # # | |
| print( | |
| Stats(profile) | |
| .strip_dirs() |