Skip to content

Instantly share code, notes, and snippets.

View kg86's full-sized avatar

kg kg86

  • LegalOn Technologies
  • Tokyo, Japan
View GitHub Profile
@sile
sile / 0_succ_bp.md
Last active July 17, 2023 23:57
簡潔データ構造やBalancedParenthesesの紹介資料メモ

発表資料メモ: 簡潔データ構造について

  1. 主題

  • 数千万オーダーの文字列集合(およびマップ)を如何にサイズ効率良く表現するか、の話
    • 諸事情で集合をメモリ上に保持したいことがあるが、サイズは節約したい
    • 実際にはサイズのみを追求するのではなく、諸々のトレードオフを加味しつつバランスを取る
  • 今回はそれを実現するための方法の一つである 簡潔データ構造 について説明する:
@fbender
fbender / sleep-timer.scpt
Last active March 5, 2024 09:51
AppleScript to put your Mac to sleep after X minutes, fading out the system volume shortly before sleeping. Can be turned into an app via the "Export" feature of the AppleScript Editor.
-- written by Florian Bender, 2015
-- based on work by Michael Wyszomierski <https://wysz.com/wyszdom/2009/06/simple-sleep-timer-with-applescript/>
-- license: Public Domain / CC0 <http://creativecommons.org/publicdomain/zero/1.0/>
tell application "System Events"
set volumeSettings to get volume settings
set volumeValue to (output volume of volumeSettings)
set fadeTime to 10 -- time in seconds for fade change
set fadeChange to (volumeValue div fadeTime)
-- display alert "Volume: " & volumeValue & ", Delta: " & fadeChange
display dialog "Sleep time (min):" default answer "25"
@smhanov
smhanov / dawg.py
Last active April 26, 2023 16:01
Use a DAWG as a map
#!/usr/bin/python3
# By Steve Hanov, 2011. Released to the public domain.
# Please see http://stevehanov.ca/blog/index.php?id=115 for the accompanying article.
#
# Based on Daciuk, Jan, et al. "Incremental construction of minimal acyclic finite-state automata."
# Computational linguistics 26.1 (2000): 3-16.
#
# Updated 2014 to use DAWG as a mapping; see
# Kowaltowski, T.; CL. Lucchesi (1993), "Applications of finite automata representing large vocabularies",
# Software-Practice and Experience 1993
@gakuzzzz
gakuzzzz / 1_.md
Last active August 2, 2023 01:59
Scala の省略ルール早覚え

Scala の省略ルール早覚え

このルールさえ押さえておけば、読んでいるコードが省略記法を使っていてもほぼ読めるようになります。

メソッド定義

def concatAsString(a: Int, b: Int): String = {
  val a_ = a.toString();
  val b_ = b.toString();
@Gab-km
Gab-km / github-flow.ja.md
Last active April 25, 2024 04:01 — forked from juno/github-flow.ja.md
GitHub Flow (Japanese translation)
@timcowlishaw
timcowlishaw / Trie.scala
Created November 14, 2011 10:06
A Trie (Prefix-tree) implementation in Scala
package uk.ac.ucl.cs.GI15.timNancyKawal {
class Trie[V](key: Option[Char]) {
def this() {
this(None);
}
import scala.collection.Seq
import scala.collection.immutable.TreeMap
import scala.collection.immutable.WrappedString