Skip to content

Instantly share code, notes, and snippets.

View GeneralD's full-sized avatar
💭
Alcohol makes better code 🥃

YUMENOSUKE GeneralD

💭
Alcohol makes better code 🥃
View GitHub Profile
#!/usr/bin/env zsh
# powerlevel9k theme settings (https://github.com/bhilburn/powerlevel9k)
# font mode
POWERLEVEL9K_MODE='nerdfont-complete'
# light theme?
# POWERLEVEL9K_COLOR_SCHEME='light'
# datetime format
export JAVA_HOME=`/usr/libexec/java_home -v $(jenv global 2>/dev/null) 2>/dev/null`
using System;
using System.Collections.Generic;
using UnityEngine;
public static class ComponentExtensions {
public static T GetOrAddComponent<T>(this Component component) where T : Component => component.GetComponent<T>() ?? component.gameObject.AddComponent<T>();
}
// ==UserScript==
// @name Google Search Helper
// @namespace http://tampermonkey.net/
// @version 0.1
// @description My helper script for Google search
// @author Yumenosuke Koukata
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js
// @match *://www.google.com/*
// @match *://www.google.co.jp/*
// @grant none
import Foundation
import UIKit
@IBDesignable class __CustomView__: UIView {
@IBInspectable var labelText: String = "" {
didSet {
label.text = labelText
}
}
# flippy
if which flippy 1>/dev/null; then
# usage: "F string" or "echo string | F"
alias -g F=__flippy
__flippy () {
if [[ $# > 0 ]]; then
flippy $@
else
local s
while read s; do
type op &>/dev/null && {
eval "$(op completion zsh)" && compdef _op op
[ -f ~/.config/op/plugins.sh ] && source ~/.config/op/plugins.sh
# enable auto-completion through op plugins
local plugins=($(\ls -1 ~/.config/op/plugins/used_items | sed 's/.[^.]*$//'))
for plugin in $plugins; do
eval "
function _${plugin}_wrapped() {
op plugin run -- $plugin \$@
zstyle ':filter-select' case-insensitive yes
zstyle ':filter-select' extended-search yes
zstyle ':filter-select' hist-find-no-dups yes
zstyle ':filter-select' rotate-list yes
bindkey '^z1' zaw-git-branches
bindkey '^z2' zaw-git-files
bindkey '^z3' zaw-git-files-legacy
bindkey '^z4' zaw-git-log
bindkey '^z5' zaw-git-recent-all-branches
#!/usr/bin/env zsh
skim_browser_bookmark_search() {
bookmarks_path=`\ls ~/Library/Application\ Support/*/*/Default/Bookmarks -t1 | head -n 1`
jq_script='
def ancestors: while(. | length >= 2; del(.[-1,-2]));
. as $in | paths(.url?) as $key | $in | getpath($key) | {name,url, path: [$key[0:-2] | ancestors as $a | $in | getpath($a) | .name?] | reverse | join("/") } | .path + "/" + .name + "\t" + .url'
(( $+commands[w3m] )) && local fetch="w3m -dump" || local fetch="curl -sfL"
jq -r "$jq_script" < "$bookmarks_path" \
#!/usr/bin/env zsh
# functions
function skim-brew-install() {
local inst=$(brew formulae | sk --query="$1" -m --preview 'brew info {}' --bind 'ctrl-space:execute-silent(brew home {})')
if [[ $inst ]]; then
for prog in $(echo $inst); do; brew install $prog; done;
fi
}