Skip to content

Instantly share code, notes, and snippets.

@sam159247
sam159247 / git-switch-fzf.sh
Created May 31, 2022 09:30
git switch with fzf
#!/bin/fish
git switch (git branch | fzf | tr -d '[:space:]')
@sam159247
sam159247 / xiaohe_keyboard_layout.json
Created April 30, 2022 02:15
小鶴雙拼注音韻母表
[
[
{
"y": 1,
"x": 1.5,
"c": "#d68b9d"
},
"Q\n\n\nㄡ\n\n\n\n一",
"W\n\n\nㄟ",
"E\n\n\nㄜ\n\n\n\n\n\n\nㄝ",
@sam159247
sam159247 / subcommand.sh
Created April 20, 2022 15:12
[shell] subcommand sample
#!/bin/sh
######################################################################
#
# SHELL subcommand and argument sample
#
# USAGE:
# bash asd.sh A
# bash asd.sh B 123
######################################################################
@sam159247
sam159247 / open_project_with_fzf.sh
Created April 19, 2022 11:58
[VSCode] Open project with fzf
#!/bin/fish
cd ~/projects
set -x PJ_PATH (find * -type d -maxdepth 0 | fzf --preview 'tree -C {} | head -200') && code $PJ_PATH && cd $PJ_PATH && clear
@sam159247
sam159247 / f24.json
Created March 19, 2022 07:28
[Karabiner-Elements] F24 to cycles the audio device to the next one.
{
"title": "F24 mapping",
"rules": [
{
"manipulators": [
{
"description": "Cycles the audio device to the next one.",
"from": {
"key_code": "f24"
},
@sam159247
sam159247 / caps_lock_mapping.json
Last active April 11, 2022 04:56
[Karabiner-Elements] caps_lock mapping
{
"title": "caps_lock mapping",
"rules": [
{
"description": "Change caps_lock to command+control+option+shift",
"manipulators": [
{
"from": {
"key_code": "caps_lock",
"modifiers": { "optional": ["any"] }
@sam159247
sam159247 / init-temp-proj.sh
Last active April 16, 2023 01:25
[Python] Initial temporary project
#!/bin/bash
cd $(mktemp -d)
poetry new --src temp_project
cd temp_project
pyenv local 3.11.3
poetry env use python
ll
poetry add --dev flake8 mypy isort black
touch src/temp.py
@sam159247
sam159247 / unsplash-shortcuts.md
Last active August 28, 2024 13:30
[Shortcuts] Change the wallpaper with unsplash API by using Shortcuts

Change the wallpaper with unsplash API by using Shortcuts

OS

  • iOS 15 or later
  • macOS Monterey or later

Usage

  1. Create an account on Unsplash
  2. Go
@sam159247
sam159247 / change-input-sources.ahk
Last active August 14, 2020 10:43
One key to change input source with AutoHotkey
#SingleInstance Force
*~LShift::Send {Blind}{vk07}
*~LAlt::Send {Blind}{vk07}
*~RAlt::Send {Blind}{vk07}
LShift::
Send {Shift Down}
return
@sam159247
sam159247 / change-input-sources.json
Last active April 30, 2022 03:20
[Karabiner-Elements] One key to change input source
{
"title": "Language toggler",
"rules": [
{
"description": "left_shift=English, left_option=Shuangpin, right_command=Japanese, ecs=Reset_ime",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "left_shift",