macOS
- 6 ответов
- 0 вопросов
2
Вклад в тег
справа экран с наглядным результатом веб-страницы
oh-my-zsh
: git
, colored-man
, zsh-syntax-highlighting
typeset -A key
if [[ "$TERM" != emacs ]]; then
[[ -z "$terminfo[kcuu1]" ]] || bindkey -M viins "$terminfo[kcuu1]" up-line-or-search
[[ -z "$terminfo[kcud1]" ]] || bindkey -M viins "$terminfo[kcud1]" down-line-or-search
fi
function zle-line-init () { echoti smkx }
function zle-line-finish () { echoti rmkx }
zle -N zle-line-init
zle -N zle-line-finish
DOT=~/.dotfiles
alias -g g='| grep'
alias -g l='| less -r'
alias -g m='| more -r'
alias -g copy='| pbcopy'
alias rm='rm -i'
alias vimrc='vim ~/.vimrc'
alias ff='rm -rf'
alias reload='source ~/.zshrc'
alias please='sudo'
alias su='sudo su -'
alias py='python3 '
alias ls='ls -G'
alias la='ls -A'
alias ll='la -l'
alias al="ls -ap | grep '^\.' | grep -v './$'"
alias a='ls -d .*'
alias jsc='/System/Library/Frameworks/JavaScriptCore.framework/Versions/Current/Resources/jsc'
alias gh="cat $DOT/oh-my-zsh/plugins/git/git.plugin.zsh | grep -i '^alias' | grep -i "
alias gw="cat $DOT/.git_wizardry | grep -i "
alias pl="mkdir playground/; cd playground/"
let text = "Первый такой текст текст такой текст текст такой текст текст\n Второй такой текст текст такой текст текст такой текст текст\n Третий такой текст текст такой текст текст такой текст текст"
let lines = split(text) { $0 == "\n" }
var counter = 0
for line in lines {
if let dirs : [String] = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomainMask.AllDomainsMask, true) as? [String] {
let dir = dirs[0] //documents directory
let path = dir.stringByAppendingPathComponent("\(counter++).txt");
//writing
line.writeToFile(path, atomically: false, encoding: NSUTF8StringEncoding, error: nil);
//reading
let text2 = String(contentsOfFile: path, encoding: NSUTF8StringEncoding, error: nil)
}
}
>>> string = "abcdef"
>>> string[0:3]
'abc'
>>> string[3:6]
'def'
>>> for x in range(0, len(string), 3):
... print(string[x:x+3])
...
abc
def