Skip to content

Instantly share code, notes, and snippets.

View lapis-zero09's full-sized avatar
🐯
nya-n

Shinsaku Kono lapis-zero09

🐯
nya-n
View GitHub Profile
@lapis-zero09
lapis-zero09 / init.lua
Last active August 1, 2019 03:59
~/.hammerspoon
hs.window.animationDuration = 0
units = {
left50 = { x = 0.00, y = 0.00, w = 0.50, h = 1.00 },
left60 = { x = 0.00, y = 0.00, w = 0.60, h = 1.00 },
left80 = { x = 0.00, y = 0.00, w = 0.80, h = 1.00 },
right50 = { x = 0.50, y = 0.00, w = 0.50, h = 1.00 },
right60 = { x = 0.40, y = 0.00, w = 0.60, h = 1.00 },
right80 = { x = 0.20, y = 0.00, w = 0.80, h = 1.00 },
import sys
class Const:
def __setattr__(self, name, value):
if name in self.__dict__:
raise TypeError("Can't rebind const (%s)" % name)
self.__dict__[name] = value
sys.modules[__name__] = Const()
import os
import tarfile
def recursive_files(dir_name='.', ignore=None):
for dir_name,subdirs,files in os.walk(dir_name):
if ignore and os.path.basename(dir_name) in ignore:
continue
for file_name in files:
if ignore and file_name in ignore:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(microsoft.graph.timeZoneInformation)",
"value": [
{
"alias": "Dateline Standard Time",
"displayName": "(UTC-12:00) International Date Line West"
},
{
"alias": "Samoa Standard Time",
"displayName": "(UTC+13:00) Samoa"
@lapis-zero09
lapis-zero09 / the_agile_samurai.ipynb
Created June 1, 2018 02:43
the_agile_samurai.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/bin/bash
while read local_ref local_sha1 remote_ref remote_sha1
do
if [[ "${remote_ref##refs/heads/}" = "origin/master" ]]; then
echo -n "Do you want to push to ${remote_ref} ${remote_sha1}? (y/n) : "
exec < /dev/tty
read answer
case $answer in
y)
@lapis-zero09
lapis-zero09 / python_formula2tex.ipynb
Last active March 27, 2018 13:44
cookbook/python_formula2tex.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
function ssh-fzf () {
local selected_host=$(grep "Host " ~/.ssh/config | grep -v '*' | cut -b 6- | fzf --query "$LBUFFER")
if [ -n "$selected_host" ]; then
BUFFER="ssh ${selected_host}"
zle accept-line
fi
zle reset-prompt
}
function ghq-fzf() {
local selected_dir=$(ghq list | fzf --query="$LBUFFER")
if [ -n "$selected_dir" ]; then
BUFFER="cd $(ghq root)/${selected_dir}"
zle accept-line
fi
zle reset-prompt
}
function history-fzf() {
local tac
if which tac > /dev/null; then
tac="tac"
else
tac="tail -r"
fi
BUFFER=$(history -n 1 | eval $tac | fzf --query "$LBUFFER")