Skip to content

Instantly share code, notes, and snippets.

@ifitzpat
ifitzpat / print.css
Created October 4, 2020 08:44
Printing configuration for org export
@media print {
h1, h2, h3, h4 {
page-break-after: avoid;
}
h2 {
page-break-before: always;
}
pre, ol, ul, table, blockquote, div.figure, div.org-src-container, div.sidebar {
page-break-inside: avoid;
}
@ifitzpat
ifitzpat / org-ref-bibtex-helpers.el
Last active August 11, 2020 13:07
some helper functions for org-ref
(defun if/pdf-isbn-or-doi-to-bibtex ()
(let ((user-input (read-string "isbn/doi/pdf-path: " (car kill-ring))))
(cond
((string-match-p "^10.[0-9]\\{4,9\\}/[-._;()/:A-Z0-9]+$" user-input) (doi-utils-doi-to-bibtex-string user-input)) ;doi
((string-match-p "pdf" user-input) (if/org-ref-pdf-to-bibtex user-input)) ;pdf
(t (if/isbn-to-bibtex user-input)))))
(defun if/start-org-roam-capture (uri)
(kill-new (replace-regexp-in-string "file:\/\/" "" uri))
(setq org-roam-capture--in-process nil)
#function adapted from http://mpastell.com/2009/09/11/matlab-style-stem-plot-with-r/
stem = function(x,y,slope,intercept,pch=16,linecol=2,clinecol=1,lty=2,from_mean=FALSE,...){
if (missing(y)){
y = x
x = 1:length(x)
}
#this plots the points
plot(x,y,pch=pch,...)
@ifitzpat
ifitzpat / boxcarGrowl.py
Last active January 8, 2016 16:07 — forked from joech4n/boxcar-growl.py
boxcar-growl.py - Send Boxcar Notification with CLI (Python)
#!/usr/bin/env python
import os
import sys
import subprocess
import shlex
def notify (token, mymessage, mytitle):
# Default config
@ifitzpat
ifitzpat / notifyBoxcar.m
Created September 24, 2015 11:08
notify Boxcar from matlab
function response = notifyBoxcar(token,mytitle,message)
url = 'https://new.boxcar.io/api/notifications';
body = {'user_credentials', token, ...
'notification[title]', mytitle, ...
'notification[long_message]', message, ...
'notification[source_name]', 'Matlab script', ...
'notification[icon_url]' , 'http://www.mathworks.com/cmsimages/64848_wl_cc_logo_membrane_2002_wl.gif', ...
'notification[sound]' , 'clanging'
};
@ifitzpat
ifitzpat / notifyBoxcar.R
Last active September 23, 2015 10:47
R script to send notifications to boxcar
notifyBoxcar = function(token,mytitle,message){
require(httr)
query = POST("https://new.boxcar.io/api/notifications",
body = list("user_credentials" = token,
"notification[title]" = mytitle,
"notification[long_message]" = message,
"notification[sound]" = "clanging",
"notification[source_name]" = "R script",
"notification[icon_url]" = "http://www.r-project.org/Rlogo.jpg"))
stop_for_status(query)
@ifitzpat
ifitzpat / elastic-net-regression-evaluation.R
Last active August 29, 2015 14:27 — forked from tonyfischetti/elastic-net-regression-evaluation.R
Code for my blog post "Kickin' it with elastic net regression"
#!/usr/bin/Rscript --vanilla
###########################################################
## ##
## elastic.R ##
## ##
## Author: Tony Fischetti ##
## tony.fischetti@gmail.com ##
## ##
###########################################################