Skip to content

Instantly share code, notes, and snippets.

View lucasvreis's full-sized avatar
🙃

Lucas Viana Reis lucasvreis

🙃
View GitHub Profile
;; this function NEEDS `lexical-binding' set to `t'
(defun boox/attach-last-figure-adb (basename)
(interactive "sName: ")
(unless (eq major-mode 'org-mode)
(user-error "Not in an org buffer"))
(require 'org-attach)
(require 'org-download)
(let ((fp "/adb:8A3DF2BF:storage/self/primary/note/export/export.pdf"))
(when (file-readable-p fp)
@lucasvreis
lucasvreis / transclusion-ids.el
Last active January 8, 2023 20:17
support [[attach:file::anchor]] and [[id:something::anchor]] links in org-transclusion
(defun org-transclusion-add-better-id (link plist)
"Return a list for Org-ID LINK object and PLIST.
Return nil if not found."
(when (string= "id" (org-element-property :type link))
;; when type is id, the value of path is the id
(let* ((both (split-string (org-element-property :path link) "::"))
(id (cl-first both))
(search (cl-second both))
(mkr (ignore-errors (org-id-find id t)))
(payload '(:tc-type "org-id")))
@lucasvreis
lucasvreis / GenericRoute.hs
Last active June 20, 2022 18:26
Proposal for Ema
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE EmptyCase #-}
module Ema.Route.Generic where
import Ema
import Generics.SOP as SOP
import Optics.Core
import Ema.Route.Encoder
@lucasvreis
lucasvreis / logs.txt
Created December 11, 2021 03:48
adb logcat | grep xDrip
12-11 00:40:17.261 4756 4756 D Notification.Badge: [invalid] onNotificationRemoved : StatusBarNotification(pkg=com.eveningoutpost.dexdrip user=UserHandle{0} id=8811 tag=null key=0|com.eveningoutpost.dexdrip|8811|null|10330: Notification(channel=null pri=1 contentView=null vibrate=null sound=null defaults=0x0 flags=0x162 color=0x00000000 category=status groupKey=xDrip ongoing vis=PUBLIC semFlags=0x0 semPriority=0 semMissedCount=0))
12-11 00:40:17.560 4756 4756 D Notification.Badge: [invalid] onNotificationPosted : StatusBarNotification(pkg=com.eveningoutpost.dexdrip user=UserHandle{0} id=8811 tag=null key=0|com.eveningoutpost.dexdrip|8811|null|10330: Notification(channel=null pri=1 contentView=com.eveningoutpost.dexdrip/0x7f0b007e vibrate=null sound=null defaults=0x0 flags=0x162 color=0x00000000 category=status groupKey=xDrip ongoing vis=PUBLIC semFlags=0x0 semPriority=0 semMissedCount=0))
(require 'texmathp)
(require 'abbrev)
(defvar text-math-abbrevs '(f g h i j k l m n p q r s t u v w x y z)
"Symbols for characters (or words) that will be literally expanded but inside math fences.")
(defun text-math--generate-abbrevs ()
(cl-loop for s in text-math-abbrevs
collect `(,(symbol-name s) ,(format "\\(%s\\)" s) nil :system t)))
@lucasvreis
lucasvreis / evil-org-headline.el
Last active August 13, 2021 04:30
Headline textobjects for org-mode with evil
(defun evil-org--parse-headline ()
(save-excursion
(end-of-line)
(outline-previous-heading)
(skip-chars-forward "* \t")
(let* ((todo-start (point))
(todo-end1 (and org-todo-regexp
(let (case-fold-search) (looking-at (concat org-todo-regexp " ")))
(goto-char (1- (match-end 0)))))
(todo-end2 (when todo-end1 (skip-chars-forward " \t") (point)))
@lucasvreis
lucasvreis / four_circle_problem.jl
Last active January 27, 2021 01:48
Solving @FogleBird's problem on twitter.
#=
Let's start with a "simpler" problem: a triangle.
In this case, a isoceles right triangle with two
sides of length 1.
This is the iso right triangle:
r₁
| \
@lucasvreis
lucasvreis / main.jl
Last active November 26, 2020 11:35
oimu
using SparseArrays
using StaticArrays
using Plots
# A - pintados até agora
# B - pintados na etapa anterior
# C - candidatos para essa etapa
# D - pintados nessa etapa
# E - candidatos para a próxima etapa
function evolve!(A,B,C,N,K)
@lucasvreis
lucasvreis / fio.md
Last active October 14, 2021 15:09
fio do twitter sobre ic

O que teoria da probabilidade, sistemas dinâmicos e minha IC podem ter a ver com amassar massa?

mafalda

Primeiro, vamos introduzir alguns termos. Um estado é uma configuração de um dado sistema; podemos nos perguntar qual estado que caracteriza algumas partículas numa caixa, por exemplo.

O conjunto de todos os estados de interesse formam um espaço, onde estados são pontos. Um subconjunto desse espaço (que pode conter um ou vários estados) é chamado de um evento; faz sentido colocar probabilidades em eventos, mas nem sempre em pontos individuais.

Uma dinâmica é um espaço junto com uma transformação que leva cada estado a um próximo estado. Cada evento está associado a uma probabilidade, que mede o tamanho relativo desse subconjunto em relação ao espaço todo.