This file contains 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
<?php | |
namespace app\modules\stuff\oauthclients; | |
use CURLFile; | |
use yii\authclient\OAuthToken; | |
use yii\base\DynamicModel; | |
use yii\web\HttpException; | |
use yii\helpers\Json; |
This file contains 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
# 读取管道中传递的文件, 并用vim打开 | |
function vip | |
{ # {{{ | |
local lines='' | |
# 从管道中读取 | |
while read x; do | |
if [[ ! "${x}" ]]; then continue; fi | |
# 绝对路径, 忽略文件夹 | |
x="$(realpath $x)" |
This file contains 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
function recover-last-version | |
{ #{{{ | |
local commit_ref=$1 | |
if [ ! "${commit_ref}" ]; then return 2; fi | |
for i in $(git diff HEAD "${commit_ref}" --name-only); do | |
vim -c 'Gvsplit HEAD~1:% | windo diffthis' -- "${i}" | |
done; | |
} #}}} |
This file contains 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 bash | |
# todo | |
# follow convention | |
# * echo -n | awk '{ print $0 }' | |
# * echo | awk '{ print $0 }' | |
read_escape() { | |
while read -r filename; do | |
escape $filename |
This file contains 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 python3 | |
import logging | |
import re | |
import shutil | |
import subprocess | |
from argparse import ArgumentParser, RawDescriptionHelpFormatter | |
from os import fdopen, unlink | |
from pathlib import Path | |
from tempfile import mkstemp |
This file contains 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
# resize pane | |
# take a look at `-i` option of command-prompt | |
bind R command-prompt -i -p 'resize-pane' 'run-shell "~/.scripts/:resize %%"' |
This file contains 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 python3 | |
import os | |
import trio | |
from trio.lowlevel import FdStream | |
from blessed import Terminal | |
from blessed.keyboard import Keystroke, resolve_sequence |
This file contains 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
<?php | |
# Swoole\Coroutine::enableScheduler(); | |
Co\run(function () { | |
$flag = 1; | |
go(function() use(&$flag) { | |
assert($flag == 1); | |
$flag += 1; |
This file contains 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
import std/[asyncdispatch, asyncnet, nativesockets, asyncfutures] | |
import std/[tables, deques] | |
type Nursery = object | |
tasks: seq[Future[void]] | |
proc startSoon(self: ref Nursery, fut: Future[void]) = | |
asyncCheck fut | |
self.tasks.add fut |
OlderNewer