Skip to content

Instantly share code, notes, and snippets.

@jenssss
jenssss / Code.js
Created April 4, 2021 05:22
Automatically update google and timetree calendars from gmail using google apps script
function readFoodAndPutInCalendar() {
var foods = readFoods();
for (var i = 0; i < foods.length; i++) {
if (isThisANewFood(foods[i])){
putFoodInGCalendar(foods[i]);
putFoodInTimetree(foods[i]);
}
}
}
@jenssss
jenssss / plot_tan.gp
Last active July 5, 2018 02:04
Gnuplot script that generates a surface plot with a rasterized png part
# This gnuplot script generates a surface plot with a rasterized png part. It uses the following external utilities
# sed
# pdflatex
# The final output is output_base.'.pdf'
output_base='tan'
# Rendering the surface plot can be heavy, so here is a switch to not to do that part (rendersurf==1 -> surface will be rendered)
rendersurf=1
@jenssss
jenssss / outer_product.f90
Created March 15, 2018 11:32
Function for calculating the outer product of two vectors in fortran
function outer_product(A,B) result(AB)
double precision, intent(in) :: A(:),B(:)
double precision, allocatable :: AB(:,:)
integer :: nA,nB
nA=size(A)
nB=size(B)
allocate(AB(nA,nB))
AB = spread(source = A, dim = 2, ncopies = nB) * &
spread(source = B, dim = 1, ncopies = nA)
end function outer_product
@jenssss
jenssss / permute-cyclic.el
Last active March 15, 2018 11:35
Emacs (lisp) function for cyclically permuting three strings
(defun permute-cyclic (first second third point-start point-end)
(interactive "sFirst \nsSecond \nsThird \nr")
(replace-string first "%" nil point-start point-end)
(replace-string second first nil point-start point-end)
(replace-string third second nil point-start point-end)
(replace-string "%" third nil point-start point-end)
)