Skip to content

Instantly share code, notes, and snippets.

@akirak
akirak / 0_reuse_code.js
Created January 2, 2014 00:17
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@akirak
akirak / ping-gce.txt
Last active February 23, 2017 06:12
ping to various server locations
# Google Compute Engine asia-east-a micro
❯ ping -c 9 107.167.188.160
PING 107.167.188.160 (107.167.188.160) 56(84) bytes of data.
64 bytes from 107.167.188.160: icmp_seq=1 ttl=60 time=11.4 ms
64 bytes from 107.167.188.160: icmp_seq=2 ttl=60 time=11.1 ms
64 bytes from 107.167.188.160: icmp_seq=3 ttl=60 time=11.1 ms
64 bytes from 107.167.188.160: icmp_seq=4 ttl=60 time=11.0 ms
64 bytes from 107.167.188.160: icmp_seq=5 ttl=60 time=11.1 ms
64 bytes from 107.167.188.160: icmp_seq=6 ttl=60 time=13.1 ms
@akirak
akirak / add-manning-to-calibre.bash
Created July 18, 2017 12:12
A tiny shell script to add a book in your Manning library (on Dropbox) to your calibre library using fzf
#!/bin/bash
python <<PYTHON | fzf -m | xargs -d'\n' calibredb add
import os.path
import glob
root = os.path.expanduser('~/Dropbox/Apps/Manning Books')
files = glob.glob(os.path.join(root, '**/*.epub'))
result = sorted(list(map(lambda f: (f, os.path.getctime(f)), files)), key=lambda t: t[1], reverse=True)
candidates = list(map(lambda f: f[0], result))
for c in candidates:
@akirak
akirak / .emacs
Created January 4, 2018 04:11
An example of minimal initialization file for Emacs with straight package manager
(setq custom-file "~/.custom.el")
;; Install straight.el
;; Just pasted from https://github.com/raxod502/straight.el#getting-started
(let ((bootstrap-file (concat user-emacs-directory "straight/repos/straight.el/bootstrap.el"))
(bootstrap-version 3))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
@akirak
akirak / ddskk-usage.org
Last active May 30, 2021 17:41
How to use DDSKK, Japanese input method for Emacs

How to Use DDSKK Japanese Input Method for Emacs

This tutorial describes the basic usage of DDSKK Japanese input method for Emacs.

Installation and configuration

Install ddskk package.

Turn on skk-mode minor mode to write Japanese. It is recommended that you should bind a key to this command:

@akirak
akirak / scratch
Created February 3, 2018 12:21
Testing Emacs for Windows
system-type
windows-nt
(getenv "HOME")
"C:\\Users\\IEUser\\AppData\\Roaming"
user-login-name
"IEUser"
(expand-file-name "~IEUser")
#!/bin/sh
# This script will setup Evm (Emacs Version Manager) and Cask on
# Travis to use for Emacs Lisp testing.
#
# In .travis.yml, add this:
#
# - curl -fsSkL https://gist.github.com/rejeep/ebcd57c3af83b049833b/raw > x.sh && source ./x.sh
#
# Emacs 24.3 is installed in the above script because Cask requires
@akirak
akirak / mkdtemp.nim
Created April 1, 2018 16:18
Creating a temporary directory in Nim (using mkdtemp)
import posix
from system import `$`
proc mkdtemp*(tmpl: cstring): cstring {.importc, header: "<stdlib.h>".}
proc createTempDirectory*(tmpl: string): string =
var s = newString(tmpl.len)
s = tmpl
if mkdtemp(s.cstring()) == nil:
raise newException(IOError, "mkdtemp returns null")
@akirak
akirak / Dockerfile
Created April 2, 2018 08:20
Nim on Fedora with RPM Fusion on Docker
FROM fedora
MAINTAINER Akira Komamura, akira.komamura@gmail.com
# Add RPM Fusion
RUN dnf -y install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm \
https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
# Install packages
RUN dnf -y install nim
# git is required by nimble to download a package
RUN dnf -y install git
@akirak
akirak / my-lemonbar.el
Last active May 7, 2018 21:51
Example configuration of lemonbar.el
(require 'lemonbar)
(setq lemonbar-options `("-b" ; Dock the bar at the bottom of the screen
"-g" "1920x20+0+0"
"-p"
"-f" "Hack-9"))
(setq lemonbar-output-template '(akirak/lemonbar-exwm-buffer-list
lemonbar-align-right
akirak/lemonbar-i3status))