Skip to content

Instantly share code, notes, and snippets.

@paxperscientiam
paxperscientiam / kill-ring-save-and-osx-clipboard.el
Last active October 22, 2015 19:17
Just a bit of emacs lisp that maps both `kill-ring-save' and `simpleclip-copy' to M-w
(require 'simpleclip)
(simpleclip-mode 1)
(define-key global-map (kbd "M-w")
(defun kill-save-copy-to-clipboard ()
"The function kill-save-copy-to-clipboard uses `simpleclip-mode' to
kill-ring-save and copy to osx clipboard using a common shortcut."
(interactive)
(if (use-region-p)
(kill-ring-save (region-beginning) (region-end)
(simpleclip-copy (region-beginning) (region-end))))))
@paxperscientiam
paxperscientiam / kill-expression-result.el
Last active November 11, 2015 20:45
Kill emacs list expression result.
;; props to #emacs
(define-key global-map (kbd "C-x C-j")
(lambda (arg)
"RTM"
(interactive "P")
(kill-new (format "%s" (eval-last-sexp arg)))))
@paxperscientiam
paxperscientiam / kill-and-copy-expression-result.el
Last active October 22, 2015 19:28
Kill and copy an expression result.
(define-key global-map (kbd "C-x C-j")
(defun kill-copy-eval-sexp (arg)
"The function `kill-copy-eval-sexp' kill-saves and copies an
expression result using `simpleclip-mode'."
(interactive "P")
(set-register ?1 (format "%s"(eval-last-sexp arg)))
(simpleclip-set-contents (get-register ?1))
(kill-new (get-register ?1))
))
@paxperscientiam
paxperscientiam / gulp-conditional-depends.js
Created October 27, 2015 19:00
// Execute task dependencies conditionally!
// requires and what not
// Execute task dependencies conditionally!
var conditional = true;
var jk = (conditional) ? ['b']:null;
gulp.task('a', jk, function() {
"use strict";
console.log("THIS IS A");
});
@paxperscientiam
paxperscientiam / EGUTF8.bas
Created November 5, 2015 02:38
Quite possibly the only way to export UTF8 formatted data from Excel 2011!
'Refer to execShell() by Robert Knight
' Or, to the StackOverflow post by Robert Knight if it still exists: https://stackoverflow.com/questions/6136798/vba-shell-function-in-office-2011-for-mac
' OMFGBBQ IT WORKS!
rngSomeRange.copy
scriptToRun = "export LC_ALL=en_US.UTF-8 && " & _
"touch " & sOutFolder & "/" & sOutFile & ".tex && " & _
"pbpaste > " & sOutFolder & "/" & sOutFile & ".tex"
@paxperscientiam
paxperscientiam / CDPathExpand
Last active March 2, 2016 21:31
Demonstration of how braces expansion can be used to shorten $PATH string.
# Version 1.0
# Pax Per Scientiam
# Bash "brace expansion" can be used to compactify long lists of paths.
# I've come up with some basic syntax rules to demonstrate this.
# For the simplest directory structure (i.e. /x00{,/x10{,/x20{,/x30}}}, the expansion result is...
# input>
CDPATH=`printf %s\\: /x00{,/x10{,/x20{,/x30}}}` && echo $CDPATH
# output> /x00:/x00/x10:/x00/x10/x20:/x00/x10/x20/x30:
@paxperscientiam
paxperscientiam / UDF_NearestInteger.bas
Created November 5, 2015 02:47
An Excel VBA UDF to round a decimal number to the nearest integer.
Function getRoundInteger(num As Double) As Double
Const BUG As Boolean = 1
Dim er As Integer: er = 0
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' getRoundInteger( ) v.1.0
' Function getRoundInteger( ) takes a double and uses the "rounds half up" method (towards +∞) to get the nearest "integer".
' The error stuff was just an experiment that will get it's on follow up.
' Works pretty well, though use at your own discretion!
' ~ Pax Per Scientiam
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
@paxperscientiam
paxperscientiam / ComputeRelativeRowsExcel.txt
Last active November 5, 2015 16:27
A review of various ways to determine relative row numbers in Excel
# v. 1.0
# Originally posted here: https://www.reddit.com/r/excel/comments/339gw7/discussion_simplest_possible_way_to_get_this/
# Use at your own discretion.
# Pax Per Scientiam
This is pretty much ripped directly from a posting I made on Reddit. I'm putting it here for posterity. Please note that I'm using the Excel 2011 (Mac) version of structured reference syntax, which I think is a bit different than that of Excel 2013 (Windows).
I've long wondered if there were a simpler way to get the relative row number of an Excel Table.
This has been my usual go to (refers to some table called "Table1" and some column therein called "column1"),which is entered into column1:
@paxperscientiam
paxperscientiam / macycle
Last active July 5, 2016 02:21
Simple script for MAC address spoofing for Bash on OSX
#!/opt/local/bin/bash
# NEWS (4/7/16) Working.
# This is an active experiment; use at your own peril!
# Comments and criticism are most welcome!
# Motivation, to get devices without captive portal support online.
#
#
# environment stuff
unset CDPATH
@paxperscientiam
paxperscientiam / runLBLL.engine
Last active December 24, 2015 03:38
TeXShop Engine for maintaining a sweet directory structure and LaTeX'ing and BibTeX'ing the correct number of times.
#!/opt/local/bin/bash
# WARNING -- AT ANY GIVEN TIME, THIS SCRIPT MAY NOT WORK DO TO CONSTANT UPDATES -- USE AT YOUR OWN PERIL!
## Added stand-alone support; may be used from the command line and from any directory.
## Added support for multiple image types
## Streamlined code to ensure minimal file shuffling.
## Corrected problem of TeXShop not auto-opening final .pdf product.
# runLBLL.engine is an .engine file for TeXShop and should be stored in ~/Library/TeXShop/Engine -- be sure to restart TeXShop
# You could store your .bib and .bst files in the /Misc directory or use TeXLive's ~/Library/texmf/bibtex/bib and ~/Library/texmf/bibtex/bib/bst, respectively, for global access
# This script will LaTeX-->BibTeX-->LaTeX-->LaTeX
# Credit: