Skip to content

Instantly share code, notes, and snippets.

View fuxialexander's full-sized avatar

Xi "Alexander" Fu fuxialexander

View GitHub Profile
@Jimx-
Jimx- / org-ocr.el
Created December 9, 2018 12:25
Recognize the text on images and insert it in place as a quote block in Org-mode
;;; org-ocr.el --- Recognize the text on images and insert it in place as a quote block in Org-mode -*- lexical-binding: t; -*-
;;; This file is NOT part of GNU Emacs
;;; License
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
@dfeich
dfeich / dfeich-hydras.el
Created May 10, 2018 15:33
Context specific Hydra launcher and some hydras used in it
;;; ** Hydras
;;; *** context launcher for hydras
(defun dfeich/context-hydra-launcher ()
"A launcher for hydras based on the current context."
(interactive)
(cl-case major-mode
('org-mode (let* ((elem (org-element-context))
(etype (car elem))
(type (org-element-property :type elem)))
(cl-case etype
@cvcore
cvcore / org-fragment-auto-preview.el
Last active May 30, 2020 18:33
Automatic fragment toggling in org-mode
;;
;; 28.07.2017
;; Charles Wang
;;
;;;;;;; Tweaks for Org & org-latex ;;;;;;
(defvar cw/org-last-fragment nil
"Holds the type and position of last valid fragment we were on. Format: (FRAGMENT_TYPE FRAGMENT_POINT_BEGIN)"
)
@nievergeltlab
nievergeltlab / heritability.r
Last active May 26, 2023 10:42
Convert heritability from observed scale to liability scale
#K=pop prevalence
#P=proportion of cases in study
#hsq=Heritability estimate (on observed scale)
#bigT = liability threshold
#tau = density of gaussian
K=0.0659
P=0.0659
h2=0.0365
zv <- dnorm(qnorm(K))