Skip to content

Instantly share code, notes, and snippets.

View replsv's full-sized avatar

Gabriel replsv

View GitHub Profile
@replsv
replsv / fix.php
Created December 14, 2015 12:50
fix manually modified serialized string
<?php
$initialData = file_get_contents("./old.ser");
$data = preg_replace('!s:(\d+):"(.*?)";!e', "'s:'.strlen('$2').':\"$2\";'", $initialData);
$fp = fopen ("./new.ser", "w");
fwrite($fp, $data);
fclose($fp);
@replsv
replsv / gist:6b577f51b7ebc6e4583b
Created July 16, 2014 14:27
Bash profile - OSX (GIT, Python, few aliases)
alias grep='grep -i --color'
export GREP_COLOR='40;01;31'
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null \
| sed -e '/^[^*]/d' -e "s/* \(.*\)/\1 /"
#| sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/"