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
# | |
# Copyright 2013 Cilyan Olowen <gaknar@gmail.com> | |
# | |
# Redistribution and use in source and binary forms, with or without | |
# modification, are permitted provided that the following conditions are | |
# met: | |
# | |
# * Redistributions of source code must retain the above copyright | |
# notice, this list of conditions and the following disclaimer. | |
# * Redistributions in binary form must reproduce the above |
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
;; Simplified variant. Add only current perspective group. | |
(with-eval-after-load "ibuffer" | |
(require 'ibuf-ext) | |
(define-ibuffer-filter persp | |
"Toggle current view to buffers of current perspective." | |
(:description "persp-mode" | |
:reader (persp-prompt (safe-persp-name (get-frame-persp)) t)) |
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
; ---------------------------------------- | |
;; dired ediff | |
; ---------------------------------------- | |
(defun my-dired-ediff-marked-files () | |
"Run ediff on 2 or 3 marked dired files." | |
(interactive) | |
(let ((marked-files (dired-get-marked-files))) | |
(if (= (safe-length marked-files) 2) | |
(ediff-files (nth 0 marked-files) (nth 1 marked-files)) | |
(if (= (safe-length marked-files) 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
(defun cofi/helm-flyspell-correct () | |
"Use helm for flyspell correction. | |
Adapted from `flyspell-correct-word-before-point'." | |
(interactive) | |
;; use the correct dictionary | |
(flyspell-accept-buffer-local-defs) | |
(let ((cursor-location (point)) | |
(word (flyspell-get-word)) | |
(opoint (point))) |
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
;; hack that enable major mode for newly created buffer according to `auto-mode-alist' | |
(defadvice set-buffer-major-mode (after new-buffer-auto-mode activate compile) | |
"Select major mode for newly created buffer. | |
Compare the `buffer-name' the entries in `auto-mode-alist'." | |
(with-current-buffer (ad-get-arg 0) | |
(if (and (buffer-name) (not buffer-file-name)) | |
(let ((name (buffer-name))) | |
;; Remove backup-suffixes from file name. | |
(setq name (file-name-sans-versions name)) |
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
(require 'evil) | |
(setq evil-move-defun-alist | |
'((ruby-mode . (ruby-beginning-of-defun . ruby-end-of-defun)) | |
(c-mode . (c-beginning-of-defun . c-end-of-defun)) | |
(js2-mode . (js2-beginning-of-defun . js2-end-of-defun)))) | |
(defun evil-move-defun (count &optional begin-defun end-defun) | |
"Move by defun" | |
(let ((count (or count 1)) |
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
(require 'cl) ;; defstruct | |
;; TODO: overwrite existing characters, don't erase the | |
;; whole buffer everytime. And only update things that | |
;; are actually different. | |
(defvar md-belt-item-max 8) | |
(defvar md-current-message nil) | |
(defvar md-message-counter 0) | |
(defvar md-num-belts 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
# | |
# | |
# Python Assistant Window | |
# v 0.1 initial release | |
# | |
# | |
#*********************************************************************************** | |
# | |
# provide a text editing window with functions to aid in coding Python within FreeCAD | |
# |
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 | |
import os | |
import odbAccess | |
import numpy as NP | |
import math | |
def open_odb(odbPath): | |
base, ext = os.path.splitext(odbPath) | |
odbPath = base + '.odb' | |
new_odbPath = None |
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 process_rpt(fname): | |
with open(fname, 'rb') as f: | |
lines = f.readlines() | |
lines_cleaned = [] | |
for line in lines: | |
# Strip leading and trailing whitespace | |
line_cleaned = line.lstrip().rstrip() | |
# Ignore blank lines | |
if len(line_cleaned): | |
# Check if first element is a float |
OlderNewer