Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

ka kaosf

🏠
Working from home
Block or report user

Report or block kaosf

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kaosf
kaosf / 1 what-to-do-to-run-xmodmap-cmd-on-bt-kbd-reconnecting.sh
Last active Sep 9, 2019
How to run "xmodmap" command when a Bluetooth keyboard is reconnected.
View 1 what-to-do-to-run-xmodmap-cmd-on-bt-kbd-reconnecting.sh
# Check your Bluetooth keyboard MAC Address by
sudo bluetoothctl devices
# Prepare .xmodmap file.
# It crashes "xmodmap $HOME/.xmodmap" command when there is no Caps_Lock keysym.
# Prepare a script file of "reconnect.sh", and change the MAC address placeholder and some commands in it.
# Run this command.
sudo btmon | bash reconnect.sh
View array-and-pointer.c
#include "stdio.h"
int main(int argc, char const* argv[])
{
int array[] = { 0, 10, 20, 30, 40 };
for (int i = 0; i < 5; i++) {
printf("%d\n", i[array]);
}
@kaosf
kaosf / karabiner-henkan-to-ctrl-space.json
Created Aug 22, 2018
Modify "Henkan" key to "Ctrl-Space" (for "before input source") on Mac High Sierra with Karabiner
View karabiner-henkan-to-ctrl-space.json
{
"title": "Henkan to Ctrl-Space",
"rules": [
{
"description": "Henkan to Ctrl-Space",
"manipulators": [
{
"type": "basic",
"description": "Henkan to Ctrl-Space",
"from": { "key_code": "japanese_pc_xfer" },
@kaosf
kaosf / ipp-anitv-parse.rb
Created Nov 8, 2017
Idol time PriPara ani.tv URL parser
View ipp-anitv-parse.rb
url_common = 'https://ch.ani.tv'
url = url_common + '/titles/353' # 353 is ipp ID
require 'open-uri'
html = open(url).read
require 'nokogiri'
doc = Nokogiri::HTML.parse html
# latest only
#puts url_common + doc.xpath('//*[@id="title-detail"]/div[1]/div[3]/div/a').attribute('href')
# 1, 2, 3, ... latest
doc.xpath('//*[@id="title-detail"]/div[1]/div[4]/div/a').each do |e|
View vim-configure.sh
# vim/vim tags/v8.0.1271 fb094e14c19337de824d4e6710ca6a2617930ab0
./configure \
--with-compiledby="myname <myemail@example.com>" \
--enable-gui=gtk2 \
--enable-perlinterp=yes \
--enable-pythoninterp=yes \
--enable-python3interp=yes \
--enable-rubyinterp \
--enable-luainterp=yes \
View deoplete-error-full.txt
Messages maintainer: Bram Moolenaar <Bram@vim.org>
[vim-hug-neovim-rpc] failed executing: pythonx import neovim
[vim-hug-neovim-rpc] Vim(pythonx):Traceback (most recent call last):
[deoplete] [vim-hug-neovim-rpc] requires `:pythonx import neovim` command to work
[deoplete] function deoplete#enable[1]..deoplete#initialize[1]..deoplete#init#_initialize[11]..deoplete#init#_cha
nnel[10]..yarp#core#notify[1]..yarp#core#wait_channel[5]..yarp#core#jobstart[2]..yarp#pyx#init[13]..yarp#core#ser
veraddr[1]..neovim_rpc#serveraddr, line 15
View deoplete-error.txt
[deoplete] function deoplete#enable[1]..deoplete#initialize[1]..deoplete#init#_initialize[11]..deoplete#init#_channel[10]..yarp#core#notify[1]..yarp#core#wait_channel[5]..yarp#core#jobstart[2]..yarp#pyx#init[13]..yarp#core#serveraddr[1]..neovim_rpc#serveraddr, line 15
View arch-linux-openbox-keyboard-shortcut.md

How to add my original keyboard shortcuts on Openbox on Arch Linux.

Backup at first and edit

~/.config/openbox/rc.xml

like following:

<?xml version="1.0"?>
View rusti.sh
set -x
# # Preparation
# sudo docker run -it quay.io/tatsuya6502/rusti
# cd ~/rusti
# cargo run
# # Ctrl+D to exit
# # Ctrl+P, Ctrl+Q to detach
CONTAINER_ID=$(sudo docker ps | grep 'quay.io/tatsuya6502/rusti' | head -1 | awk '{print $1}')
@kaosf
kaosf / aws-cli-docker-install.sh
Last active Aug 17, 2017
aws-cli with Docker (deprecated)
View aws-cli-docker-install.sh
sudo pip uninstall awscli
pip install --user awscli
export PATH=$HOME/.local/bin:$PATH
# You don't have to use Docker now.
You can’t perform that action at this time.