This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Restore your backed up nvim config. Use the backup-nvim.zsh script to create the backup. | |
restore-nvim() { | |
local backup_array=(${(f)"$(command ls -1d ~/.config/nvim.* | sort -nr | sed -e 's/.*nvim/nvim/')"}) | |
if [ $#backup_array = 0 ]; then | |
echo "No backup directory found" | |
return 1 | |
fi | |
for ((i = 1; i <= $#backup_array; i++)) print -r -- "[$i] $backup_array[i]" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# backup my nvim config | |
# backup my neovim config. you can restore the config by using restore-nvim.zsh | |
backup-nvim() { | |
local timestamp=$(date "+%Y-%m-%d-%H%M") | |
echo "Backup following directories" | |
echo " ~/.config/nvim => ~/.config/nvim.${timestamp}" | |
echo " ~/.local/share/nvim => ~/.local/share/nvim.${timestamp}" | |
echo " ~/.local/state/nvim => ~/.local/state/nvim.${timestamp}" | |
echo " ~/.cache/nvim => ~/.cache/nvim.${timestamp}" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
_has () { | |
return $( whence $1 &>/dev/null ) | |
} | |
getresolution () { | |
# returns current resolution | |
if [[ "$OSTYPE" == "darwin"* ]]; then | |
system_profiler SPDisplaysDataType | awk '/Resolution:/{print $2 "x" $4}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
_has () { | |
return $( whence $1 &>/dev/null ) | |
} | |
getresolution () { | |
# returns current resolution | |
if [[ "$OSTYPE" == "darwin"* ]]; then | |
system_profiler SPDisplaysDataType | awk '/Resolution:/{print $2 "x" $4}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
## @since 2020-05-15 | |
## @last 2021-01-05 | |
## @author takuya | |
## unbound にブロッキング | |
## ブロッキングするURLを定期的に更新する | |
function update_domain_lists(){ | |
update280blocker |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git-add-screenshot () { | |
# I need colors! | |
autoload -Uz colors; | |
colors | |
if [ $# -lt 1 ]; then | |
echo "Usage: $0 imagefile [branch_name (default: images)]" | |
echo " Create 'images (by default)' branch and push image file to GitHub/GitLab." | |
echo " The URL to pushed image file is also copied to your clipboard." | |
echo " (ex.) $0 screenshot.png" | |
return 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import collections | |
import datetime | |
from os import path | |
import pickle | |
import sys | |
if len(sys.argv) < 2: | |
print("Usage: bindify.py zonefile") | |
sys.exit(0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [[ "$OSTYPE" == "linux-gnu" ]] | |
then | |
export DISTRO=$(lsb_release -si) | |
fi | |
port_usage() { | |
echo "port: A wrapper function for $1." | |
echo "Supported commands:" | |
echo " port clean" | |
echo " port contens \$package" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# vim: set fileencoding=utf-8 : | |
# -*- coding: utf-8 -*- | |
# | |
# Last modified: Thu, 29 Oct 2020 00:50:55 +0900 | |
from datetime import timedelta, date | |
import locale | |
# https://stackoverflow.com/a/1060330 | |
def daterange(start_date, end_date): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A zsh function which will check my proxy configuration. | |
# Runs only on macOS. | |
proxycheck() { | |
local red=`tput setaf 1; tput bold` | |
local green=`tput setaf 2; tput bold` | |
local cyan=`tput setaf 6; tput bold` | |
local reset=`tput sgr0` | |
local systemflag=0 | |
networksetup -listallnetworkservices | while read line | |
do |
NewerOlder