Skip to content

Instantly share code, notes, and snippets.


Taka necojackarc

View GitHub Profile
necojackarc / Set up Vim with clipboard on Ubuntu on
Last active Aug 3, 2022
Set up Vim on Ubuntu on Windows Subsystem for Linux 2 (WSL2) to share clipboard
View Set up Vim with clipboard on Ubuntu on

This explains how to set up Vim on Ubuntu 18.04 on Windows Subsystem for Linux 2 (WSL2) in order to share the clipboard between Windows and Ubuntu.


  • Windows 10 Home
  • Ubuntu 18.04 on Windows Subsystem for Linux 2 (WSL2)


  1. Build Vim with the clipboard option enabled
  2. Set up VcXsrv Windows X Server
necojackarc / format_url.js
Last active Sep 25, 2019
Format URL function that can be partially applied made for fun!
View format_url.js
'use strict';
const qs = require('qs');
function format_url(base) {
const remove_trailing_slash = (element) => {
return element.endsWith('/') ? element.slice(1, -1) : element;
const remove_leading_slash = (element) => {
necojackarc / JavaScript DateOnly and TimeOnly
Last active Jul 27, 2018
JavaScript DateOnly and TimeOnly classes
View JavaScript DateOnly and TimeOnly
'use strict';

const moment = require('moment');

class DateOnly {
   * @param {moment|Date|string} input an object or a string moment.js can parse
  constructor(input) {
necojackarc / Settings for
Last active Jul 5, 2022
Notes to set up macOS
View Settings for


  • Show all filename extensions on Finder (Finder -> Preferences -> Advanced)
  • Show Path Bar on Finder (Finder -> View)
  • Install KeeWeb to manage credentials
  • Install Google Drive to sync important files such as KeePass file
  • Install Google Chrome
  • Install AlDente to limit maximum charging percentage
  • Show App Switcher (cmd+TAB) on all displays
    • defaults write appswitcher-all-displays -bool true
  • killall Dock
View Run test scripts for all packages under a Yarn workspace with
$ yarn workspaces info --json | jq -rc '.data | fromjson | keys | .[]' | sed 's/^/yarn workspace /g' | sed 's/$/ test/g' | sh
View Install Watchman on Ubuntu

This instruction will store the source in /usr/local/src following the linux convention.

$ sudo apt update
$ sudo apt install libssl-dev autoconf automake libtool python-setuptools python-dev
$ cd /usr/local/src
$ sudo git clone
$ cd watchman
$ sudo git checkout v4.9.0  # the latest stable release
$ sudo ./
View PostgreSQL Initial

Describes what I always do when installed PostgreSQL.

  1. Create new user who has the same power as postgres
  2. Change login method when connecting it via host names

1. Create new user who has the same power as postgres

Connect postgres DB as postgres user:

View Configure AWS Lambda handlers to keep them warm with Serverless and

To use AWS Lambda (Serverless) with RDS in production, you should

  • warm up functions
  • preserve DRS connections

configure_handlers.js configures Serverless handler functions to achieve them.


View Simulate document click events on iOS.js
function initialize() {
if (!is_ios()) return;
let document_click_on_ios;
document.addEventListener('touchstart', () => {
document_click_on_ios = true;
document.addEventListener('touchmove', () => {
View Install Yarn on

Following the official guide, you'll bump into the following error:

$ sudo zypper ref
Repository 'Google-Chrome' is up to date.
Retrieving repository 'Yarn' metadata --------------------------------------------------------------------------------------------------------------------------------------------------------------------------[\]
Warning: File 'repomd.xml' from repository 'Yarn' is signed with an unknown key '9CBBB5586963F07F'.

    Note: Signing data enables the recipient to verify that no modifications occurred after the data
    were signed. Accepting data with no, wrong or unknown signature can lead to a corrupted system