Skip to content

Instantly share code, notes, and snippets.

@necojackarc
necojackarc / Windows-like Karabiner-Elements Configuration.md
Last active February 20, 2024 10:46
Windows-like Karabiner-Elements Configuration
@necojackarc
necojackarc / Office 365 Tips.md
Last active January 30, 2024 18:59
Office 365 Tips

Outlook Web

  • Show declined events (Settings > Calendar > Events and invitations)
  • Publish a calendar to Google Calendar (Settings > Calendar > Shared Calendars > Publish a calendar > Copy the ICS link > Import from URL on Google Calendar)
@necojackarc
necojackarc / GitHub Cli One-liner to Add Collaborators to All Repos.md
Last active January 26, 2023 16:02
GitHub CLI one-liner to add all repos in the organisation to a specific user or team

Conditions

# 50 is the number of repositories to be listed
gh repo list -L 50 <organisation> | \
 awk '{print $1}' | \
@necojackarc
necojackarc / Set up Vim with clipboard on Ubuntu on WSL2.md
Last active December 28, 2023 02:45
Set up Vim on Ubuntu on Windows Subsystem for Linux 2 (WSL2) to share clipboard

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.

Environments

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

Steps

  1. Build Vim with the clipboard option enabled
  2. Set up VcXsrv Windows X Server
@necojackarc
necojackarc / format_url.js
Last active September 25, 2019 16:29
Format URL function that can be partially applied made for fun!
'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
necojackarc / JavaScript DateOnly and TimeOnly classes.md
Last active July 27, 2018 09:45
JavaScript DateOnly and TimeOnly classes
'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
necojackarc / Mac Settings.md
Last active February 20, 2024 10:46
Mac Settings

General

  • Show the battery percentage (System Settings > Control Centre > Battery)
  • Show all filename extensions on Finder (Finder > Settings > Advanced)
  • Show Path Bar on Finder (Finder > View)
  • Install KeePassXC 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 com.apple.Dock appswitcher-all-displays -bool true
$ yarn workspaces info --json | jq -rc '.data | fromjson | keys | .[]' | sed 's/^/yarn workspace /g' | sed 's/$/ test/g' | sh

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 https://github.com/facebook/watchman.git
$ cd watchman
$ sudo git checkout v4.9.0  # the latest stable release
$ sudo ./autogen.sh

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: