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 functools import partial | |
| class Infix(object): | |
| def __init__(self, func): | |
| self.func = func | |
| def __or__(self, other): | |
| return self.func(other) | |
| def __ror__(self, other): | |
| return Infix(partial(self.func, other)) | |
| def __call__(self, v1, v2): |
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 types import MethodType | |
| class MyObj(object): | |
| def __init__(self, val): | |
| self.val = val | |
| def new_method(self, value): | |
| return self.val + value | |
| obj = MyObj(3) |
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 forbiddenfruit import curse, reverse | |
| # add method to int type | |
| def words_of_wisdom(self): | |
| return self * "blah " | |
| curse(int, "words_of_wisdom", words_of_wisdom) | |
| # add classmethod | |
| def hello(self): |
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
| # This file has been auto-generated by i3-config-wizard(1). | |
| # It will not be overwritten, so edit it as you like. | |
| # | |
| # Should you change your keyboard layout some time, delete | |
| # this file and re-run i3-config-wizard(1). | |
| # | |
| # i3 config file (v4) | |
| # | |
| # Please see http://i3wm.org/docs/userguide.html for a complete reference! |
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
| set nocompatible | |
| inoremap jk <esc> | |
| set scrolloff=999 | |
| set wildmenu | |
| set path+=** | |
| set number | |
| set expandtab | |
| set autoindent | |
| filetype plugin indent on | |
| syntax enable |
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
| ;;;; Emacs configuration file | |
| ;;;; Compile configuration file | |
| (defun autocompile nil | |
| "compile itself if ~/.emacs" | |
| (interactive) | |
| (require 'bytecomp) | |
| (let ((dotemacs (file-truename user-init-file))) | |
| (if (string= (buffer-file-name) (file-chase-links dotemacs)) | |
| (byte-compile-file dotemacs)))) |
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
| # i3status configuration file. | |
| # see "man i3status" for documentation. | |
| # It is important that this file is edited as UTF-8. | |
| # The following line should contain a sharp s: | |
| # ß | |
| # If the above line is not correctly displayed, fix your editor first! | |
| general { | |
| colors = true |
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
| <?xml version="1.0" encoding="UTF-8" standalone="no" ?> | |
| <FCParameters> | |
| <FCParamGroup Name="Root"> | |
| <FCParamGroup Name="BaseApp"> | |
| <FCParamGroup Name="LogLevels"> | |
| <FCInt Name="Default" Value="2"/> | |
| </FCParamGroup> | |
| <FCParamGroup Name="Preferences"> | |
| <FCParamGroup Name="General"> |
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
| ## Finding the angle between two faces of a part. | |
| s1 = doc.Geometry.Shape.Faces[0] | |
| s2 = doc.Geometry.Shape.Faces[1] | |
| vns1 = s1.normalAt(0,0) | |
| vns2 = s2.normalAt(0,0) | |
| alpha = math.degrees(vns1.getAngle(vns2)) |
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
| ; SICP 3.5 Streams | |
| ; constraints :- | |
| ; (stream-car (cons-stream x y)) = x | |
| ; (stream-cdr (cons-stream x y)) = y | |
| (define the-empty-stream '()) | |
| (define stream-null? null?) |