Skip to content

Instantly share code, notes, and snippets.

View gwangjinkim's full-sized avatar

Gwang-Jin Kim gwangjinkim

  • Pharma
  • Freiburg i. Br., Germany
View GitHub Profile
# What's the most natural way to express this code in base R?
library(dplyr, warn.conflicts = FALSE)
mtcars %>%
group_by(cyl) %>%
summarise(mean = mean(disp), n = n())
#> # A tibble: 3 x 3
#> cyl mean n
#> <dbl> <dbl> <int>
#> 1 4 105. 11
#> 2 6 183. 7
@vseloved
vseloved / dwim-graph.lisp
Last active August 29, 2024 09:07
Simple generation of graph images using dot (and cl-dot)
(defclass dwim-graph () ())
(defmethod cl-dot:graph-object-node ((graph (eql 'dwim-graph)) object)
(make-instance 'cl-dot:node
:attributes (list :label (format nil "~A" object)
:shape :circle)))
(defmacro dwim-graph ((file &key (directed t)) &body edges)
`(progn
(eval-when (:compile-toplevel :load-toplevel :execute)
@vseloved
vseloved / rutils-tutorial.md
Last active August 29, 2024 09:07
RUTILS Tutorial

RUTILS Tutorial

Overview

RUTILS is split into two parts: core (package rutils) and contrib (package rutilsx). These are aggregate packages that just re-export the symbols that are provided by the specific packages like rutils.anaphora or rutils.list. Overall, there are 17 parts of the core, which are described, in more detail, in this tutorial. They include (with some changes and additions) 3 facilities, which are also available from separate libraries: SPLIT-SEQUENCE, ITERATE, and ANAPHORA. Besides, it defines 2 lightweight wrapper data structures: pair and hash-set.

There's also the package rtl that includes the core plus short names for a lot of basic Lisp operations.

Contrib holds "experimental" stuff (in the sense that it's not totally conventional even for me) that, gradually, migrates to core. I won't talk more about it in the tutorial: those who are interested can check on their own or ask questions.

@vseloved
vseloved / unit-numbers.lisp
Created August 19, 2019 06:37
Prototype of dimensional numbers implementation
(set-dispatch-macro-character #\# #\M #'read-dimensional-number)
(set-dispatch-macro-character #\# #\I #'read-dimensional-number)
(defun read-dimensional-number (s c n)
(declare (ignore n))
(let* ((prev-case (readtable-case *readtable*))
(val (unwind-protect
(progn (setf (readtable-case *readtable*) :preserve)
(symbol-name (read s nil)))
(setf (readtable-case *readtable*) prev-case)))

Теми курсових проектів

Проекти, для яких немає готових корпусів

  1. Визначення зв’язків між сутностями на основі даних з Wikipedia, Freebase, DBPedia тощо для української мови.
  2. Визначення суб’єктивних висловлювань в текстах новин (зокрема, новин українською мовою).
  3. Генерація поезії. Доступні дані: сайти з віршами, словники рим тощо.
  4. POS-tagging для української мови. Проанотованих корпусів немає, але є граматичний словник та корпуси сирих текстів.
  5. Перевірка правопису для української мови. Дані можна проанотувати через LanguageTool; також схожий проект є тут.
  6. Автоматична генерація відповідей на запитання. Дані можна брати з Вікіпедії чи https://ukrainian.stackexchange.com (та інших SE сайтів).

Bedtools Cheatsheet

General:

Tools Description
flank Create new intervals from the flanks of existing intervals.
slop Adjust the size of intervals.
shift Adjust the position of intervals.
subtract Remove intervals based on overlaps b/w two files.
@vseloved
vseloved / aoc9-deck.lisp
Last active August 29, 2024 09:09
Advent of Code #9
(defun play-game (max-players last-marble)
(let ((scores (make-hash-table))
(marbles (deque 0)))
(dotimes (marble (1+ last-marble))
(case (mod (1+ marble) 23)
(0 (drotate marbles 7)
(incf (gethash (rem marble max-players) scores 0)
(+ 1 marble (popl marbles))))
(t (drotate marbles -2)
(pushl (1+ marble) marbles))))
@vseloved
vseloved / nnse.lisp
Created April 19, 2017 14:41
Unfinished code for NNSE calculation
(in-package #:nlp.embeddings)
(named-readtables:in-readtable rutilsx-readtable)
(eval-always
(rename-package "BKNR.SKIP-LIST" "BKNR.SKIP-LIST" '("SKLIST")))
(defun gather-freq-dict (vecs dir &key (cutoff 0) (dump-file "/tmp/dict.txt"))
(let ((dict #h(equal))
(idxs #h(equal))
@nicco88
nicco88 / todoList.js
Last active June 8, 2022 06:49
Todo List app study (by Gordon Zhu), www.watchandcode.com
// VERSION 1 - Arrays
// 1 It should have a place to store todos
// 2 It should have a way to display todos
// 3 It should have a way to add new todos
// 4 It should have a way to change a todo
// 5 It should have a way to delete a todo
/*-------------------------------------*/