Skip to content

Instantly share code, notes, and snippets.

View chernyshev's full-sized avatar
:octocat:

Yuriy Chernyshev chernyshev

:octocat:
View GitHub Profile
@chernyshev
chernyshev / custom.zsh-theme
Last active June 2, 2018 10:48
custom.zsh-theme
local ret_status="%(?:%{$fg_bold[green]%} :%{$fg_bold[red]%} )%{$reset_color%}"
local folder=" %{$fg[cyan]%}%c%{$reset_color%}"
PROMPT='${folder}%{$fg_bold[yellow]%} ❯ %{$reset_color%}'
RPROMPT='$(git_prompt_info)'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[cyan]%}\uf126 %{$fg_bold[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[cyan]%}*"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[cyan]%}"
@chernyshev
chernyshev / sed cheatsheet
Created April 30, 2017 04:41 — forked from ssstonebraker/sed cheatsheet
Sed Cheatsheet
FILE SPACING:
# double space a file
sed G
# double space a file which already has blank lines in it. Output file
# should contain no more than one blank line between lines of text.
sed '/^$/d;G'
@chernyshev
chernyshev / vbox-reload
Created October 4, 2015 12:23
virtualbox reload
sudo launchctl load /Library/LaunchDaemons/org.virtualbox.startup.plist
ssh -Ng -L 5000:localhost:5432 user@myapp.com
@chernyshev
chernyshev / gist:2857e08ed3bf53d7b514
Created July 15, 2015 08:24
array transpose with php
function transpose($array) {
    array_unshift($array, null);
    return call_user_func_array('array_map', $array);
}

NULL is given as the parameter to array_unshift, which adds a value to the start of the array. So, the first line inserts NULL as the first value of the array. The next line calls array_map with all the entries of $array as the parameters. So it's the same as calling array_map(NULL, $array[0], $array[1], $array[2], etc etc). In the array_map documentation there's a detail: "An interesting use of this function is to construct an array of arrays, which can be easily performed by using NULL as the name of the callback function"

sudo tcpflow -i eth0 -e http -a -c host xxx.compute-1.amazonaws.com
@chernyshev
chernyshev / gist:d0710d1c6cb8b25157e1
Last active August 29, 2015 14:20
How can I find what file the program is trying to access that causes poll system call to timeout?

Invoke:

lsof -p <pid>

And see what the file descriptors in question refer to.

You can also take a look into proc filesystem on Linux:

https://help.github.com/articles/generating-ssh-keys/
https://help.github.com/articles/working-with-ssh-key-passphrases/
@chernyshev
chernyshev / gist:1172c31d9fbbac1e7895
Last active August 29, 2015 14:14
Parallels - Reset Windows User Password
prlctl list --all
prlctl set <UUID> --userpasswd <USERNAME>:<PASSWORD>
@chernyshev
chernyshev / gist:edb09375892f52f13800
Last active August 29, 2015 14:06
debugging cli scripts with xdebug
export XDEBUG_CONFIG="idekey=XDEBUG_PHPSTORM"