Skip to content

Instantly share code, notes, and snippets.

Avatar

Dmitriy dmitriynet

  • Nadavi
  • Ukraine, Kiev
View GitHub Profile
View gist:2c4ff8d066cad72d88ece1fa9205aac2
// ==UserScript==
// @name BW
// @version 1
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @include http://brokenworlds.online*
// ==/UserScript==
window.addEventListener('load', function() {
$(function(){
@dmitriynet
dmitriynet / grep.sh
Created Feb 24, 2016
Grep unique by regex
View grep.sh
tail -n 100000 kj.log | grep -o -E "\w+$" | sort -u
@dmitriynet
dmitriynet / dump.sh
Created Feb 10, 2016
Dump per tables SH
View dump.sh
username=$1
password=$2
dbname=$3
for file in *.sql; do
echo "${file%.sql}.sql started\n";
mysql -u $username -p$password --default-character-set=utf8 $dbname < "${file%.sql}.sql";
echo "${file%.sql}.sql done\n";
done;
@dmitriynet
dmitriynet / Dump to database
Last active Jan 20, 2016
Dump to database
View Dump to database
username=$1
password=$2
dbname=$3
for file in *.sql; do
echo "${file%.sql}.sql started\n";
mysql -u $username -p$username --default-character-set=utf8 $dbname < "${file%.sql}.sql";
echo "${file%.sql}.sql done\n";
done;
@dmitriynet
dmitriynet / php
Created Nov 20, 2015
mb_unserialize
View php
function mb_unserialize($string)
{
$recovered = preg_replace_callback(
'!(?<=^|;)s:(\d+)(?=:"(.*?)";(?:}|a:|s:|b:|d:|i:|o:|N;))!s',
function($match) {
return 's:' . mb_strlen($match[2], '8bit');
},
$string
);
View Xdebug remote debug and profiler
xdebug.profiler_append = 1
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 0
xdebug.idekey="PHPSTORM"
xdebug.remote_enable=true
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_connect_back=1
xdebug.remote_autostart=1
xdebug.remote_log="/usr/local/apache/logs/xdebug.log"
View Useful Terminal Commands
lsof -i :9000
tcpdump -nn "port 9000"
watch -n1 'mysql -u "username" -pPASSW --exec="SHOW PROCESSLIST"' // REALTIME PROCESS LIST MYSQL