Skip to content

Instantly share code, notes, and snippets.

View kenjisato's full-sized avatar

Kenji Sato kenjisato

View GitHub Profile
library(dplyr)
library(sf)
library(tmap)
library(rmapshaper)
#' Install googlesheets4 with
#' remotes::install_github("tidyverse/googlesheets4")
#' devtools::install_github("tidyverse/googlesheets4")
library(googlesheets4)
@kenjisato
kenjisato / rewrite_for_moodle.R
Last active October 11, 2019 00:29
Convert nops_eval.zip for Moodle
# This function assumes that the 'Full name' column in Grading Worksheet
# has the following form: "Name registration_number".
# This assumption may fail for other instances of moodle, in which case
# we have to use different logic to merge 'Grading Worksheet' and
# regiatraion.csv and/or nops_eval.csv.
rewrite_for_moodle <- function(nops_zip,
worksheet_csv, # Downloaded from Moodle
nops_csv = NULL,
worksheet_points_col = "Grade",
@kenjisato
kenjisato / default.css
Created October 3, 2019 07:46
Shim for nops_eval_write() in R package {exams}
#listview li {
line-height: 150%;
}
#Data {float: left; }
#ExamResults {}
#Evaluation {}
#ExamSheet { float: right; }
@kenjisato
kenjisato / determinant.py
Last active December 6, 2018 00:31
Determinant of a matrix (practice)
from itertools import permutations
def find_a_cycle(x, start):
cycle = [start]
s = start
while x[s] != start:
cycle.append(x[s])
s = x[s]
return cycle
@kenjisato
kenjisato / sgn.py
Last active December 6, 2018 00:32
Sign of a permutation
def find_a_cycle(x, start):
cycle = [start]
s = start
while x[s] != start:
cycle.append(x[s])
s = x[s]
return cycle
def find_cycles(x):
@kenjisato
kenjisato / keynote_export.applescript
Last active April 23, 2024 12:09
Script to Export Keynote Presentation Files to PDF or JPEG
on sansExt(theFileName)
do shell script "file=" & theFileName & ";" & "echo ${file%.*}"
end sansExt
on getExt(theFileName)
do shell script "file=" & theFileName & ";" & "echo ${file##*.}"
end getExt
on run argv
set keynote_path to (item 1 of argv)
@kenjisato
kenjisato / child.Rmd
Created March 21, 2017 11:06
Rmd to LaTeX without preamble
---
title: title
author: author
output: html_document
---
# Section header
Body text goes here.
@kenjisato
kenjisato / Rprofile
Last active December 1, 2020 05:15
Cross Referenceable Equation with Preview in RMarkdown: http://en.kenjisato.jp/rmarkdown-math/
.beginMath = c(
"\\begin{equation}",
"\\begin{equation*}",
"\\begin{align}",
"\\begin{align*}"
)
.endMath = c(
"\\end{equation}",
"\\end{equation*}",
@kenjisato
kenjisato / 2015-07-06.ipynb
Created July 6, 2015 05:39
2015 経済動学 講義資料 (2015-07-06)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kenjisato
kenjisato / 2015-06-29.ipynb
Created June 29, 2015 05:02
2015 経済動学 講義資料 (2015-06-29)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.