Skip to content

Instantly share code, notes, and snippets.

Milos Tomic tmilos

Block or report user

Report or block tmilos

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
tmilos /
Last active May 17, 2018
Reset MYSQL root password
# Stop MySQL
sudo service mysql stop
# Make MySQL service directory.
sudo mkdir /var/run/mysqld
# Give MySQL user permission to write to the service directory.
sudo chown mysql: /var/run/mysqld
# Start MySQL manually, without permission checks or networking.
sudo mysqld_safe --skip-grant-tables --skip-networking &
# Log in without a password.
tmilos / tmilos_on_gmail.gpg
Last active May 12, 2018
My GPG Public Key
View tmilos_on_gmail.gpg
Version: GnuPG v1
View ldap_read_users.php
$ldapconn = ldap_connect('')
or die("Could not connect to LDAP server.");
$un = 'domain\\username';
$pw = 'password';
$ldapbind = ldap_bind($ldapconn, $un, $pw);
tmilos / index.js
Last active May 31, 2016
NodeJS Promises
View index.js
"use strict";
const Promise = require('bluebird')
class MyAction {
constructor (name, nextAction, preFail, postFail) { = name
this.nextAction = nextAction
this.preFail = preFail
tmilos / arabic.php
Created Nov 25, 2015
Arabic translation dummy generator
View arabic.php
$fileTemplate = __DIR__.'/../../app/Resources/translations/messages.%s.xliff';
$fromLocale = 'en';
$toLocale = 'ar';
$sourceFile = sprintf($fileTemplate, $fromLocale);
$targetFile = sprintf($fileTemplate, $toLocale);
$stringLetters = <<<EOT
tmilos /
Last active Oct 7, 2019
Modified Preorder Tree Traversal

Modified Preorder Tree Traversal

Hierarchical data metrics that allows fast read operations on tree like structures.

Based on Left and Right fields that are set during tree traversal. When entered into node value is set to it's Left, when exiting node value is set to it's Right.

Sample implementation

View gist:113f9d7884ea58112efa
### Keybase proof
I hereby claim:
* I am tmilos on github.
* I am tmilos ( on keybase.
* I have a public key whose fingerprint is 2906 0696 3E16 7038 78FE B234 DF2A A652 71C9 1CE4
To claim this, I am signing this object:
tmilos / foo.json
Created Oct 21, 2014
testing gist
View foo.json
"foo": "bar"
You can’t perform that action at this time.